Tutorial by Examples

The if statement does not need any particular installation or setup.
The if statement is a conditional statement that allows a program to enter or not a specific section of code depending if the condition(s) of the statement are met or not. It can be found in mostly all the existing programming languages. The if statement will usually take the following shape: if(s...
A statement is usually a test on a variable or the return value of a function. To test those values, we can use some relational operators: OperatorMeaningExample==Equal to1 == 1 is TRUE, 1 == 2 is FALSE!=Not equal to1 != 2 is TRUE, 1 != 1 is FALSE<Less than1 < 2 is TRUE, 2 < 1 is FALSE>...
It is possible to ask a program to execute a specific section of code only if an if statement is considered false. For this, we use the else key word. if(statement) { // Code to execute if the statement is true. } else { // Code to execute if the statement is false. } Both code se...

Page 1 of 1