home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / timevent / taskmstr / cond_02.tsk < prev    next >
Encoding:
Text File  |  1995-05-07  |  2.0 KB  |  88 lines

  1. ///////////////////////////////////////////////////////////////////////
  2. //
  3. // Examples of how to utilize WHILE/BREAK/CONTINUE/LOOP.
  4. //
  5. ///////////////////////////////////////////////////////////////////////
  6.  
  7.  
  8. ///////////////////////////////////////////////////////////////////////
  9. //  WHILE/LOOP combination
  10.  
  11.     // set variable 0 to 1 (specify two digits for comparison with 10)
  12.     DEFINE %0 01
  13.  
  14.     // contine exection until %0 is not less than 10
  15.     WHILE %0<10
  16.  
  17.       // display a message to the console command
  18.       ECHO %0 is less than 10
  19.  
  20.       // increment %0 by 1
  21.       DEFINE %0 %0+=1
  22.  
  23.     LOOP
  24.  
  25.  
  26. ///////////////////////////////////////////////////////////////////////
  27. //  WHILE NOT/LOOP combination
  28.  
  29.     // set variable 0 to 20
  30.     DEFINE %0 20
  31.  
  32.     // contine exection if %0 is not equal to 10
  33.     WHILE NOT %0==10
  34.  
  35.       // display a message to the console command
  36.       ECHO %0 is not equal to 10
  37.  
  38.       // decrement %0 by 1
  39.       DEFINE %0 %0-=1
  40.  
  41.     LOOP
  42.  
  43.  
  44. ///////////////////////////////////////////////////////////////////////
  45. //  using the BREAK command
  46.  
  47.     // set variable 0 to 1
  48.     DEFINE %0 01
  49.  
  50.     // contine exection if %0 is less than 10
  51.     WHILE %0<10
  52.  
  53.       // display a message to the console command
  54.       ECHO %0 is less than 10
  55.  
  56.       // increment %0 by 1
  57.       DEFINE %0 %0+=1
  58.  
  59.       // if %0 is equal to 5 break out of loop
  60.       IF %0==5 THEN BREAK
  61.  
  62.     LOOP
  63.  
  64.  
  65. ///////////////////////////////////////////////////////////////////////
  66. //  using the CONTINUE command
  67.  
  68.     // set variable 0 to 1 (specify two digits for comparison with 10)
  69.     DEFINE %0 01
  70.  
  71.     // contine execution if %0 is less than 10
  72.     WHILE NOT %0<10
  73.  
  74.       // display a message to the console command
  75.       ECHO %0 is less than 10
  76.  
  77.       // increment %0 by 1
  78.       DEFINE %0 %0+=1
  79.  
  80.       // if %0 is greater than 5 then bypass the next ECHO
  81.       IF %0>5 THEN CONTINUE
  82.  
  83.       // display another message
  84.       ECHO %0 is less than 5
  85.  
  86.     LOOP
  87.  
  88.