I propose a new keyword and structure for our loops. I think the syntax is more intuitive and concise, and the controls are really necessary to turn the infinite looping mechanism into a really powerful and flexible tool.

IN UR LOOP
  BTW This is a continue:
  NEXT PLZ

  BTW This is a break:
  THATS ALL
KTHX

That's it. Pure and simple. It also makes writing the assembly for it reeeally easy =)

Kyle, 2007/05/29 05:46

I think I still prefer “IM IN YR LOOP” rather than just “IN YR LOOP”. Dropping the “IM” kinda loses some of the charm of the language. Hmm…not sure about the end tag. I'm torn between some variation of KTHX (“KTHXLOOP”?) and “IM OUTTA YR LOOP”. — ILikePi, 2007/05/29 12:11


Can we name the loops arbitrarily? Then break out of them or start over at any point by calling them by name?

e.g.

HAI
CAN HAS STDIO?
I HAS A YURZ
IM IN UR HOUSE
    VISIBLE "RAIDIN UR GOODZ"
    YURZ IZ 0
    IM IN UR FRIDGE
        VISIBLE "COUNTIN UR FOODZ"
        UP YURZ!!1
        IZ YURZ BIGGER THAN 10?
            YA RLY
                VISIBLE "NO THX TOO MANY FOODZ! GOTTA WATCH MY FIGURE"
                GTF OUTTA FRIDGE
            NO LOL
                VISIBLE YURZ
        OKTHX
    IM OUTTA UR FRIDGE
    IM IN UR LIVINGROOM
        VISIBLE "STEALING UR NINTENDOZ"
        I HAS A SLEEPING
        BTW random number generator maybe?
        SLEEPING IS SOMEWHERE BETWEEN NO LOL AND YA RLY
        IZ SLEEPING?
            YA RLY
                VISIBLE "WIN! GIMMEH UR WII"
            NO LOL
                VISIBLE "O SHIT YOU CAUGHT ME"
                GTF OUTTA HOUSE
        OKTHX
    IM OUTTA UR LIVINGROOM
IM OUTTA UR HOUSE
KTHXBYE

fury, 2007/05/29 14:38

If lolcode ever adds OOP, I think IM IN YR [watever] would be good as a with{} block.

About the last comment… I don't think we need labels on loops. Let's just add a GOTO statement to the language (not necessarily called that way). LOLCODE would be way more fun if you could write spaghetti code with it xD

Nicolas, 2007/05/29 18:16

I agree with Nicolas, see goto.

shox, 2007/05/30 17:26


For loop control, I propose 'NM' (never mind) as break and 'MOAR' as continue.

Alternatively, 'PWNT' for break, but I feel that should be used for more egregious purposes.

Geordan Rosario, 2007/05/30 20:46


I like IM IN YR for the loop. Check out this construction:

I HAS A FISH ITZ 0
IM IN YR HOUSE UPPIN YR FISH WATCHIN YR FISH IZ BIGGER THAN 10
   VISIBLE "O HAI!, THIS IZ FISH0RZ NUMBAR " N FISH
IM OUTTA YR HOUSE

UPPIN YR (or NERFIN YR) updates the var. WATCHIN YR is the breakout test.

An idea. — Risser, 2007/05/31 19:33


A possible suggestion for declaring a while(condition) loop could be in the format :

WATCH DIZ <operator> IZ <expression>
   VISIBLE "LOLCATS"
COOL HAY

golgy, 2007/06/01 10:15

contributions/looping.txt · Last modified: 2007/06/01 00:17 by golgy
Recent changes RSS feed Creative Commons License Donate Driven by DokuWiki