Difference between revisions of "DO WHILE"

From Recital Documentation Wiki
Jump to: navigation, search
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Class==
 
Applications
 
 
 
 
==Purpose==
 
==Purpose==
 
Repeat a block of commands while a specified condition is true
 
Repeat a block of commands while a specified condition is true
Line 18: Line 14:
  
 
==See Also==
 
==See Also==
[[DO]], [[DO CASE]], [[EXIT]], [[FOR]], [[IF]], [[LOOP]], [[SCAN]]
+
[[DO]], [[DO CASE]], [[EXIT]], [[FOR]], [[FOREACH]], [[IF]], [[LOOP]], [[SCAN]]
  
  
Line 24: Line 20:
 
The DO WHILE command repeats the commands between the DO WHILE and the ENDDO statement, until the specified <condition> becomes .F.  The maximum number of nested DO WHILE loops allowed is 16.
 
The DO WHILE command repeats the commands between the DO WHILE and the ENDDO statement, until the specified <condition> becomes .F.  The maximum number of nested DO WHILE loops allowed is 16.
  
If the specified <condition> result is .T., then all commands within the DO WHILE loop will be executed.  If the specified condition returns an .F., the Recital/4GL will skip down to the first statement following the ENDDO to continue execution.
+
If the specified <condition> result is .T., then all commands within the DO WHILE loop will be executed.  If the specified condition returns an .F., Recital will skip down to the first statement following the ENDDO to continue execution.
  
 
Note: Use of redefined macros in the body of the loop is not supported.
 
Note: Use of redefined macros in the body of the loop is not supported.
Line 50: Line 46:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 
[[Category:Applications]]
 
[[Category:Applications]]
 
[[Category:Applications Commands]]
 
[[Category:Applications Commands]]
 +
[[Category:Looping Commands]]

Latest revision as of 14:45, 14 January 2010

Purpose

Repeat a block of commands while a specified condition is true


Syntax

DO WHILE <condition>

[EXIT]

[LOOP]

ENDDO


See Also

DO, DO CASE, EXIT, FOR, FOREACH, IF, LOOP, SCAN


Description

The DO WHILE command repeats the commands between the DO WHILE and the ENDDO statement, until the specified <condition> becomes .F. The maximum number of nested DO WHILE loops allowed is 16.

If the specified <condition> result is .T., then all commands within the DO WHILE loop will be executed. If the specified condition returns an .F., Recital will skip down to the first statement following the ENDDO to continue execution.

Note: Use of redefined macros in the body of the loop is not supported.

EXIT

If an EXIT statement is encountered then the DO WHILE loop is exited.

LOOP

If a LOOP statement is encountered, then control returns to the head of the DO WHILE loop.

ENDDO

The ENDDO statement terminates the DO WHILE loop. Commands within the DO WHILE must be properly nested.


Example

use patrons index events, names
seek "OPERA"
do while event = "OPERA"
    display name, event, seats*price off
    skip
enddo


Products

Recital Server, Recital