SPL to HP C/XL Migration Guide (30231-90001)
6-6
| is executed. If it is false, and the ELSE | |
| clause is present,
else-statement
is | |
| executed; if the ELSE clause is omitted, | |
| execution falls through to the statement | |
| after
true-statement
.| |
|||
---------------------------------------------------------------------------------------------
-
|||
| If the ELSE clause is present, | Regardless of whether the else clause is |
|
true-statement must not
end with a | present, a simple
true-statement must
end |
| semicolon. | with a semicolon. (The terminating "}" of |
| | a compound statement implies the |
| | semicolon.) |
|||
| | Note that the
condition-clause
is enclosed |
| | in parentheses and that THEN is deleted. |
|||
---------------------------------------------------------------------------------------------
-
Table 6-10. IF Statement Examples
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| | |
| IF X<0 THEN Y:=0; | if (X<0) Y=0; |
| | |
| IF X>0 THEN | if (X>0) |
| BEGIN | { |
| Y:=0; | Y=0; |
| T:=V+10; | T=V+10; |
| END; | } |
| | |
| IF X=0 THEN X:=21 | if (X==0) X=21; |
| ELSE | else |
| BEGIN | { |
| Y:=0; | Y=0; |
| T:=V+10; | T=V+10; |
| END; | } |
| | |
---------------------------------------------------------------------------------------------