Subject: can one break out of a for?

From: [email-masked]
Date: Fri, 25 Jun 1993 10:22:36 -0700

X-Operating System: SMP DC/OSx 1.0-92b011 dcosx
X-Mailer: ELM [version 2.3 PL11]

I was going to ask the following:
<<BEGIN
How would one get out of the following loop after the statement 'awake = 1"?
 19:  for frod in (this.location.contents)
 20:     if (is_player(frod))
 21:       if (E_INVARG != connected_seconds(frod))
 22:         awake = 1;
 23:       endif
 24:     endif
 25:   endfor 
END>>

Then I decided to try putting a "break;" after 22 and it compiled ok. 

I don't think this is in the "The MOO Programming Language" manual. 
Perhaps it should be added (or at least added to the index if it is in the 
text somewhere I couldn't find).
-- 
John Moore     HAM:NJ7E    CAP:Thunderbird 381 
[email-masked] 
Voice: day or eve:(602) 951-9326 FAX:602-861-7642 (by prior arrangement)
USnail: 7525 Clearwater Pkwy, Scottsdale, AZ 85253 
Opinion: Support ALL of the bill of rights, INCLUDING the 2nd amendment!
Bad Advice: Long palladium, short petroleum ;-)

---

From: Pavel Curtis <[email-masked]>
Date: Fri, 25 Jun 1993 11:14:15 -0700

> Date:	Fri, 25 Jun 1993 10:22:36 -0700
> From:	[email-masked]
> To:	[email-masked]
> Subject: can one break out of a for?
> 

It's not documented because there *is* no `break' statement in the MOO language
at present.  Your statement was interpreted as a variable reference (and it
will generate an error when executed unless there is a statement earlier in
that verb that assigns a value to the variable `break'.

Because there is no `break' statement right now (or any other way than `return'
to prematurely end a FOR loop), I recommend either using a WHILE loop instead
or putting this loop into a separate verb so that `return' can be used to
terminate it.

	Pavel