SPL to HP C/XL Migration Guide (30231-90001)
6-3
Table 6-4. DO Statement Examples
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| | |
| DO BEGIN | do { |
| X := X + 1; | X = X + 1; |
| A(X) := B(X); | /*could also be: X++; */ |
| END | A[X] = B[X]; |
| UNTIL X=100; | } |
| | while (!(X==100)); |
| | /*test could be: (X!=100)*/ |
| | |
---------------------------------------------------------------------------------------------
WHILE Statement
Table 6-5. WHILE Statement
---------------------------------------------------------------------------------------------
|| |
| SPL | HP C/XL Equivalent |
|| |
---------------------------------------------------------------------------------------------
|| |
|
while-statement
: | Similar to SPL: |
|| |
| WHILE
condition-clause
DO
loop-statement
| while (
condition-clause
)
loop-statement
|
|| |
---------------------------------------------------------------------------------------------
|| |
| The
loop-statement
(which may be compound) | Same as SPL. |
| is executed only if and while the | |
|
condition-clause
remains true. If | The
condition-clause
must be enclosed in |
|
condition-clause
is false to begin with, | parentheses. Also, remove the keyword DO. |
|
loop-statement
is not executed at all. | |
|| |
---------------------------------------------------------------------------------------------
Table 6-6. WHILE Statement Examples
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| | |
| WHILE X <> 100 DO | while (X != 100) |
| BEGIN | { |
| X := X + 1; | X = X + 1; /*could be: X++; */ |
| A(X) := B(X); | A[X] = B[X]; |
| END; | } |
| | |
---------------------------------------------------------------------------------------------