3.4.2 if-endif
Description
If the single-line if statement is true, only the operation of branching to a specific address will occur. If executing other operations or multiple statements is necessary, the if-endif block should be used.
The form is as follows: If <Boolean expression> is true, the multiple number of <statement> between if and endif will be executed in order. If <Boolean expression> is false, skipping to the position after endif will occur without the <statements> being executed.
Syntax
Example
In the following example, if the pressure is greater than the limit, the following assignment and print statements will be executed. Otherwise, branching to the end will occur without the statements being executed.
In the example program, the statements between if and endif are indented by two spaces. These statements are indented to make it easier to recognize that they are codes for the blocks nested between if and endif.
Last updated
Was this helpful?