July 15, 2017

Core PHP: The If Else Statement (5.0)

Conditional Statements

Conditional statements perform different actions for different decisions.
The if else statement is used to execute a certain code if a condition is true, and another code if the condition is false.
Syntax:
if (condition) {
   code to be executed if condition is true;
} else {
   code to be executed if condition is false;
}

You can also use the if statement without the else statement, if you do not need to do anything, in case the condition is false.

No comments:

Post a Comment