FOR i := 1 TO 100 DO BEGIN // option 1: IF MyExitCondition = TRUE THEN EXIT; //this exits the function, not only the loop. so be careful // option 2: IF MyExitCondition THEN i := 101; //code after this statement will still be executed, but not then next loop iteration END;
If aRec.FINDSET THEN REPEAT IF MyExitCondition THEN EndOfLoop := TRUE; ELSE EndOfLoop := aRec.NEXT = 0 UNTIL EndOfLoop;
Answers
For REPEAT ... UNTIL loop you can use something like this:
Third possible alternatie (although I don't recommend using it) is to put your code in a report based on the Integer table, let the report to do the looping and use CurrReport.BREAK.
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03