REPEAT

Contents


Repeat allows you to perform loops until a condition is true.

 

Syntax

Repeat
..... instructions
Until l_expr

 

Parameters

Element

Description

Restrictions

l_expr

logical_expression

None

 

Example

# Entry until you obtain a transaction number
# Exit if the condition is verified
Repeat
Gosub LEC_TRANSAC
If [F:STT]TRSNUM = "" : Call ERREUR(GMESSAGE) From GESECRAN: Endif
Until [F:STT]TRSNUM <> ""

 

# Display of the hierarchical elements
# Exit by break
Pickbox [ZMT] SEL
& [F:ZMT]YITMREF Titled "",
& [F:ZMT]YUOM Titled "",
& [F:ZMT]YITMDES Titled ""
& Sized(160,240)
& Titled "Selection Window"
& At(40,40)
& As [PIC]
Boxact [PIC]
Fillbox [PIC]

#entry in the hierarchical selection box
$SAIPIC
Boxinp [PIC] Using RESU
Case RESU
    When GSTAPIC
   
Repeat
        Pick [PIC]
        Case status
            When 7, 44: Break
            When 37: Gosub SELECTION
            When 41: Gosub DESELECTION
        Endcase
    Until 1=0
    When GSTAPKF: Goto FIN
    When GSTAESC, GSTAFIN: Goto FIN
Endcase
Goto SAIPIC

 

Description and Comments

Repeat allows you to perform loops until a condition is true, i.e., the corresponding numeric expression is not null.
These are the only ways to exit from the loop:

·         The loop condition must become true

·         To us Break, which interrupts the loop

Number of iterations:
The loop is performed at least once - even if the condition is true from the beginning. Its execution stops as soon as the condition becomes true.

 

Associated Errors

Error

Description

ERMODE (10)

l_expr is not numeric.

 

Associated Keywords

FOR - BREAK - WHILE - UNTIL - IF


CONTENTS


Copyright © Sage 1999 - 2007