Intro
Very often when you write code, you want to perform different actions for different decisions.
You can use conditional statements in your code to do this.
In Kin we have the following conditional statements:
Use niba
to specify a block of code to be executed, if a specified condition is true
Use nanone_niba
to specify a block of code to be executed, if the same condition is false
Use niba_byanze
to specify a new condition to test, if the first condition is false
Niba Statement
Use the niba
statement to specify a block of Kin code to be executed if a condition is true.
niba (condition) {
# Codes to execute if the condition is true
}
Note that
niba
is in lowercase letters. Uppercase letters (Niba
orNIBA
) will generate a Kin error.
Niba_byanze Statement
Use the niba_byanze
statement to specify a block of code to be executed if the condition is false.
niba (condition) {
# block of code to be executed if the condition is true
} niba_byanze {
# block of code to be executed if the condition is false
}
Nanone_niba Statement
Use Use the nanone_niba
statement to specify a new condition if the first condition is false.
niba (condition1) {
# block of code to be executed if condition1 is true
} nanone_niba (condition2) {
# block of code to be executed if the condition1 is false and condition2 is true
} niba_byanze {
# block of code to be executed if the condition1 is false and condition2 is false
}