Exit: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Created page with "The '''exit''' command breaks out of a loop, in the way one would normally from "break" commands in other languages. It should not be used outside of loops. It should be used instead of break if the intention is to actually leave the loop early. See also continue, return and terminate. == Example == set j 0 whilen j 3 { add j 1 userquote 500 exit userquote 400 } Makes quote 500 be displayed exactly once..."
 
(No difference)

Latest revision as of 05:11, 7 January 2024

The exit command breaks out of a loop, in the way one would normally from "break" commands in other languages. It should not be used outside of loops.

It should be used instead of break if the intention is to actually leave the loop early.

See also continue, return and terminate.

Example

   set j 0
   whilen j 3
   {
       add j 1
       userquote 500
       exit
       userquote 400
   }

Makes quote 500 be displayed exactly once, and quote 400 not a single time.