exit a repeat-handler

Karl Petersen karlpet at mac.com
Sat Jun 1 19:47:01 EDT 2002


At 9:21 PM +0200 6/1/02, meili wrote:
>Why is it not possible to exit the following repeat-forever-handler by
>using the mouseclick-function?
[snip]
>   repeat forever
>     if the mouseclick then
>       break
>     end if
>  end repeat


Your script works okay here, meili. But the Transcript Dictionary says this:

"The word break appears on a line by itself, within a case section of 
a switch control structure."

And this:

"The break command should not be used outside a switch structure. If 
it appears outside a switch structure, it has the same effect as the 
exit control structure."

So it's probably better form to use something like this:

repeat until the mouseClick
   do stuff
end repeat

Or this:

repeat
   if the mouseClick then exit repeat
end repeat

Karl



More information about the use-livecode mailing list