Official Content

Executes a block of code repeatedly, until its condition becomes false.

Syntax

Do while Condition
       Code
Enddo

Where:

Condition
    Any valid logical expression. The condition is evaluated prior to the execution of the commands.

Code
    Block that is executed while the condition evaluated is true.
 

Scope

Objects: Procedure, Transaction, Web PanelPanel

Description

This command executes every command within the Do while and the Enddo sentence, until the condition cond becomes false.

Any command can be specified within a Do while-EndDo group.

To force an exit from the Do while group you may use the Exit command.
 

Samples

Suppose you need to print ten equal lines. To solve this need you can define the following code inside a Procedure Source:

&i = 1
Do while &i <= 10
   Print printblock1   /* The printblock contains fixed texts */
   &i = &i + 1
EndDo

See Also

Exit command

For To Step command
For In Array Command




Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant