If else
Last Updated on 23. March 2023 by Martin Schuster
The if statement splits the program flow according to a condition. The syntax looks like that:
if(i <= 100){
// do something here
}else{
// do something else here
}
If the condition in the round brackets is evaluated to true the program code in the curly brackets is executed. If the condition in the round brackets is false the program code in the else block is executed instead.
The else part is optional.