dwww Home | Show directory contents | Find package

#
# Unit test for `break` and `continue` commands
# Two different entry actions:
# "load break_continue.dem" executes the main loop
# "call break_continue.dem foo" executes the inner clause
#
if (ARGC == 0) {

do for [i=1:6] {
    print "start ", i;
    call 'break_continue.dem' sub1
    if (i > 4) { print ">>> ERROR <<<" }
    print "end ", i
}
print "done with for loop"

} else {

print "   continue if i == 3, break if i > 4"
if (i > 4) { break; }
if (i == 3) { continue; print ">>> ERROR <<<" }
print "      still in load file"
exit    # exits only from this level of the call stack
print ">>> failed to exit <<<"
}

Generated by dwww version 1.15 on Mon Jun 24 14:13:26 CEST 2024.