If
The if statement is the condition by which the code is executed.
It has the following syntax:
==============================
Condition in parentheses is true If true, the code in curly braces will execute
For example:
Output:
Welcome
==============================
The if statement can be followed by an else statement, which will run if the condition is false.
For example:
==============================
Output:
Not allowed
==============================
You can check for multiple conditions using the else if statement.
For example:
Output:
Negative
Коментарі