![]() |
command?
what exactly does the for command do??
|
for (a; b; c) d;
First executes a; then, until b is false, executes d and c. for (i = 0; i < 5; i ++) { playerx = i; sleep 0.5; } |
Yeah, the for command is a type of loop.
Using the example Loriel used: NPC Code:for (a ; b ; c) a is usually where the variable initialization takes place. NPC Code:i = 0; b is where the program checks whether or not the requirements to meet the loop are met. If the requirements are met, the loop is peformed and c is done. NPC Code:i < 10; c is the increment. NPC Code:i++ Becareful not to place yourself in infinite loops... NPC Code:for (i = 0;i < 10;i--) ...such a case. Hope I did not confuse you more than you were before :(. |
i=0;
while (i<5){ i++ } Is the same as for (i=0;i<5;i++){ } |
Also a do loop is almost the same as a for and a while, just the fact that a do loop does the loop first then checks requirements.
NPC Code: That is the basic format incase anyone who doesn't know, wants to. |
But unfortunatly a do loop does not yet work on Graal :|
|
Quote:
|
Pft, nobody uses do {} while (); loops anyway.
|
Quote:
so true ^_^ first time that a saw the debugger changes for loops into whiles i was like "omg wtf??? GRAAL CHANGERD MY SCRIPT!!!!!" but then i looked at it and said.. "oh.. its the same damn thing" |
| All times are GMT +2. The time now is 02:14 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.