Hitachi

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


17.6.4 while-loop

The while-loop statement executes the specified expressions repeatedly until the specified condition becomes false. You have to enclose a condition to be specified with parentheses.

Organization of this subsection

(1) Format

while (condition)
    expression-1;
    expression-2;
loop;

(2) Description

  1. Conditions are evaluated.

  2. If the condition first becomes false, the main part of the while statement is never executed, and the control moves from the while statement to the next statement in the same program.

  3. If the condition is true (not 0), the main part of the statement is executed, with all expressions executed repeatedly from expression-1.

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

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

You should not nest more than 255 while loops.

(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;
}
...
...
while ( sloop_cnt < sloop_max)
   AIT_LogMessage("The active window is being found");
   if (AIT_FocusWindow("Unpacking...", "#32770",0.0) > 0)
   if(AIT_FocusWindow("Unpacking software to be installed...", "#32770", 0.0) > 0)
          AIT_LogMessage("Unpacking software to be installed... is opened");
      sloop_cnt= 0;
      AIT_Sleep(SLEEP_TIME);
   endif;
   endif;
   AIT_Sleep(SLEEP_TIME);
   sloop_cnt = sloop_cnt + 1;
loop;