img

Сonditional Statement if - else

If the expression in parentheses is true, the operator/operators listed in curly brackets{} are executed. If the expression within brackets is false, then the operators in {} after the keyword else are used.

Example:

 if(price<min && price>min) { System.Print("Price is out of range"); } else { System.Print("Price is within the range"); } 

The else keyword is optional.

The statement if-else may be used without curly brackets { and } , in this case, only the operator specified after if is executed.

Example:

 if(a==5) System.Print("a==5"); System.Print("regardless the value of a");