HAI
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP, UPPIN YR VAR!!1 TILL 10
	VISIBLE VAR
IM OUTTA YR LOOP
KTHXBYE

Alternate loop style, with control statements confined to the beginning. Modified original suggestion by incorporating the terminating condition into the loop header.


For now, I don't think our specific loop syntaxes have to be set in stone… I think a basic infinite loop with loop controls is far more flexible in the long run than defining extensions to the loop construct for “UPPIN UR VAR!!”, “NERFIN UR VAR!!”, etc… And these also don't seem to build in the terminating condition, which is part of the syntactic benefit from using a standard three-argument for loop.

Maybe after real LOLCODE starts getting written, we can see what sorts of loops we are writing the most often and what sort of syntax would best fit in (and most flexibly fit in) with the rest of the language and be easy to implement.

Kyle, 2007/05/29 04:29


I think the end-of-loop keyword should be MOAR instead of IM OUTTA YR …

Tony Finch, 2007/05/29 09:37


Well, the terminating condition is the line immediately following…I suppose it could be reworked to better indicate this. — ILikePi, 2007/05/29 12:13


Perhaps the terminating condition could be on the OUTTA line? That way, it could also be used for do/until blocks.

IM IN YR LOOP, UPPIN YR VAR!!1
	VISIBLE VAR
IM OUTTA YR LOOP, HAVIN VAR IZ 10

Ah, not a bad idea…how about WIF instead, since someone else was looking for a way to use WIF…

IM IN YR LOOP, UPPIN YR VAR!!1
	VISIBLE VAR
IM OUTTA YR LOOP, WIF VAR BIGGER THAN 10

ILikePi, 2007/05/29 17:51


How about something like:

IM IN UR LOOP
  ...
MOAR

For a generic loop that's up to the user to control and

IM IN UR LOOP COUNTIN MAH [VAR] FROM [start val] [DOWN]TO [end val] [BY step val]
  ...
MOAR

For a explicitly controlled loop?

Also,

IM IN UR LOOP PLAYING WITH MY [list or iterator] [BACKWARDS]
  ...
MOAR

for a for each style loop?


I'm thinking

IM IN YR LIST, GETTIN YR VAR
  ^^ VAR is each LIST
IM OUTTA YR LIST

So if the LOOP in IM IN YR LOOP is already the name of a list it does a foreach — Al 2007/05/31 25:49 BST

I think MOAR would be better used as 'continue', or maybe MOAR PLZ