View unanswered posts | View active topics It is currently Thu Jan 24, 2019 1:50 am

Reply to topic  [ 1 post ] 
Author Message
Rank 6
Rank 6

Joined: Wed May 17, 2017 7:35 am
Posts: 25
Here's one example I found that looks like a basic for loop
(from "init/std/base/main/brain/code/event/gui_event.dat")
//    loc.res = true;
//    [loc.res]*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.

Fri May 26, 2017 6:55 pm
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group.
Designed by X-Moon Productions.