forked from HerculesWS/Hercules
-
Notifications
You must be signed in to change notification settings - Fork 0
Mike Kao edited this page Jun 16, 2023
·
1 revision
The do...while' is the only post-test loop structure available in this script language. With a post-test, the statements are executed once before the condition is tested. When the condition is true, the statement(s) are repeated. When the condition is false, control is transferred to the statement following the do...while' loop expression.
do { Code to execute(1) } while (expression(2))&#59;
Example 1: sentinel-controlled loop mes "This menu will keep appearing until you pick Cancel"&#59; do { set .@menu, select("One:Two:Three:Cancel")&#59; } while (.@menu != 4)&#59;
Example 2: counter-controlled loop mes "This will countdown from 10 to 1."&#59; set .@i, 10&#59; do { mes .@i&#59; set .@i, .@i - 1&#59; } while (.@i > 0)&#59;