Hitachi

JP1 Version 12 JP1/IT Desktop Management 2 Distribution Function Administration Guide


18.6.5 do-while

The do-while statement executes the specified expressions repeatedly until the specified end condition is evaluated as false. You have to enclose a condition to be specified with parentheses.

Organization of this subsection

(1) Format

do
   expression-1
   expression-2
   ...
   ...
while (condition);

(2) Description

  1. The main part of the do-while statement is executed.

  2. Next, the condition is evaluated. If the condition is false, the do-while statement ends, and the control moves to the next statement in the same program. If the condition is true (not 0), the expressions are executed repeatedly from expression-1.

  3. When the system encounters a break statement specified in the main part of that statement, the loop ends.

  4. When the system encounters a continue statement specified in that statement, the subsequent steps are skipped, with the condition evaluated. If the condition is true, the execution is repeated.

  5. In other words, the main part of the loop is executed at least once.

You should not specify more than 255 break or continue statements in a loop. Moreover, you should not nest more than 255 do-while statements.

(3) Example of coding

DEFINE
{
integer WINH,count,length;
float SLEEP_TIME=0.5;
string s1,s2;
integer i,sloop_cnt   = 0;
integer sloop_max = 30;
}
...
...
do
   AIT_LogMessage("Searching for Active windows");
   if (AIT_FocusWindow("Installable Software", "#32770",0.0) > 0)
        if(AIT_FocusWindow("Unpacking Installable Software...", "#32770", 0.0) > 0)
            AIT_LogMessage("Unpacking Installable Software... is opened");
            sloop_cnt= 0;
            AIT_Sleep(SLEEP_TIME);
        endif;
   endif;
   AIT_Sleep(SLEEP_TIME);
   sloop_cnt = sloop_cnt + 1;
while ( sloop_cnt < sloop_max);
...
...