Statements
Like in all programing languages there are statements, so we added statements
IF statement
An "if statement" is a programming structure that executes a block of code only if a specific condition is true, and skips it otherwise or execute some other componenta.
Basic syntax
How to use the statements
The if
statement is a control structure in many programming languages that allows you to execute a block of code conditionally, based on the truth value of a specified expression. In this case, the expression being evaluated is .
Here's the if
statement with an else
clause:
if
statement with an else
clause:if
- keyword used to begin anif
statement- expression that is evaluated as true or false
do
- keyword used to begin the block of code to be executed if the expression is truethe
components
that will be runned if the expression is trueelse
- keyword used to specify the block of code to be executed if the expression is falsethe
components
that will be executed if the expression is falseend
- keyword used to end theif
statement
Here's the if
statement without an else
clause:
if
statement without an else
clause:if
- keyword used to begin anif
statement- expression that is evaluated as true or false
do
- keyword used to begin the block of code to be executed if the expression is truethe
components
that will be executed if the expression is trueend
- keyword used to end theif
statement
Last updated