xmoonproductions.org
https://www.xmoonproductions.org/

looping
https://www.xmoonproductions.org/viewtopic.php?f=28&t=5102
Page 1 of 1

Author:  enkephalin07 [ Fri May 26, 2017 6:55 pm ]
Post subject:  looping

Here's one example I found that looks like a basic for loop
(from "init/std/base/main/brain/code/event/gui_event.dat")
Code:
//    loc.res = true;
//    [loc.res]*20
    [true]*20
    {
      loc.val += "s";
      loc.val += loc.i;
      loc.val += ":v";
      loc.val += Rnd(79);
     
      loc.i += 1;   
      [loc.i > loc.obj2] break; // loc.res = false;
     
      [loc.res] loc.val += "|";
    }
   
The code I added shows that a constant can be used as the condition and a break statement will escape the loop. But only constants are accepted for the *n part. Is there a way to make an indefinite while loop from this? I know I found one other loop example with a different usage, but I can't locate it now.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/