HP 3000 Manuals

WHILE Statement [ SPL to HP C/XL Migration Guide ] MPE/iX 5.0 Documentation


SPL to HP C/XL Migration Guide

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;                                |         }                                   |
|                                             |                                             |
---------------------------------------------------------------------------------------------



MPE/iX 5.0 Documentation