Executes a series of statements as long as a given condition is TRUE.

 

When the condition  is TRUE, all statements are executed until the ENDWHILE statement is encountered.  When ENDWHILE is reached, control then returns to the WHILE  statement where the condition is checked again.   If condition is still TRUE, the process is repeated.  When the condition is not TRUE, execution resumes with the statement following the ENDWHILE statement.

 

Unlike the FOR statement, the WHILE statement evaluates condition on every loop pass.

 

Syntax:

WHILE condition
  [statements]
ENDWHILE

 

Parameter:

Description:

condition

Expression that evaluates to TRUE or FALSE.

[statements]

One or more statements executed while condition is True.

 

Example:

VARIABLES: a TYPE: Integer
 
WHILE ( a > 0 )
  print "a = ", a
  a = ( a - 1 )
ENDWHILE

Returns:

Example shows how to repeat a process by looping back over the values until a condition is no longer True.

 

Links:

DO, FOR

See Also:

 

 


Edit Time: 9/25/2017 09:09:58 AM


Topic ID#: 649

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software