Well, there are a bunch of ways to do this. Here's a quick and dirty way to get out of an infinite loop:


break on

while forever
 
 if $i = 100
  goto "GetOut"
 endif
 
 $i = $i + 1

loop

:GetOut

?"i=$i"

exit

But normally, one would include a condition in the WHILE statement that would break out of the loop gracefully, like this:

break on

while $i < 100
 
 $i = $i + 1

loop

?"i=$i"

exit

Or, if you don't really have anything handy to loop against, you can always just create a flag and set it to false insode the loop, like this:

break on

$flag = 1 ; true

while $flag

 $i = $i + 1

 if $i = 100
  
  $flag = 0 ; false

 endif

loop

?"i=$i"

exit

Hope this helps

-Shawn

[ 28 February 2002: Message edited by: Shawn ]