- Download the file from here
- Update your path:
- From the Start search bar, enter 'env' and select "Edit environment variables for your account"
- Under User variables, check if there is an entry called Path
- If the entry exists, append the full path to desiredNcodiFolder\ using ; as a separator from existing values
- If the entry doesn't exist, create a new user variable named Path with the full path to desiredNcodiFolder\ as its value
Coming soon...
To print something to the console, use the ekteb()
function:
ekteb("Hello, Tunisia!")
Variables store data for later use. Think of them as containers with a name and a value.
var x = "Hello again"
ekteb(x)
Constant variables (const) cannot be changed after declaration:
const x = "No Name"
x = "Ncodi" // This will result in an error
Ncodi supports several data types:
Integers are whole numbers, positive or negative:
var num1 = 458
var num2 = 15
ekteb(num1 + num2)
Decimals are numbers with a floating point:
var dec = 4.25
ekteb(dec)
Strings are textual data enclosed in quotation marks:
var s = "Code in your own words"
var x = "51" // This is a string, not an integer
ekteb(s)
Boolean values can be either s7i7 (true) or ghalet (false):
var res = s7i7
var nope = ghalet
ekteb(res)
You can specify the type of a variable when declaring it:
var num:int = 1564
var dec:decimal = 1.5
var really:bool = ghalet
var esmi:string = "Aziz Amari"
- Addition: +
- Subtraction: -
- Multiplication: *
- Division: /
- Euclidean Division: //
- Modulo: %
- Exponentiation: **
- Greater than: >
- Greater than or equal to: >=
- Less than or equal to: <=
- Equal to: ==
- Not equal to: !=
- AND: &&
- OR: ||
- NOT: !
var x:int = int(a9ra())
kan x % 2 == 0 {
ekteb(string(x) + " is an even number")
} wela {
ekteb(string(x) + " is an odd number")
}
var language = a9ra()
kan language == "ncodi" {
ekteb("Great Language")
} wela kan language == "python" {
ekteb("Mehh !")
} wela {
ekteb("I don't know this language yet: " + language)
}
men ... ila loop
men num = 0 ila 10 {
ekteb(num)
}
madem (lang != "ncodi" && lang != "Ncodi") {
ekteb("Wrong, think again")
lang = a9ra()
}
ekteb("YES")
var lang = "ncodi"
dir {
ekteb(lang)
} madem lang != "ncodi"
ekteb("output")
ekteb(len("aziz"))
- ekteb(): Prints to the screen
- a9ra(): Prompts for user input
- sqrt(): Calculates square root
- random(): Generates a random number
- ord(): Converts a character to its ASCII code
- chr(): Converts an ASCII code to a character
asne3 hey() {
ekteb("Hello from ncodi servers")
}
asne3 greet(name:string, times:int) {
men i = 0 ila times {
ekteb("Hello " + name + " " + string(i))
}
}
asne3 pow(n:int, p:int):int {
raje3 n ** p
}
// Calling the functions
hey()
greet("Aziz Amari", 4)
var x = pow(2, 8)
ekteb(x)