-
Notifications
You must be signed in to change notification settings - Fork 0
Loops
Michał edited this page Mar 10, 2023
·
3 revisions
Example for loop in IterkoczeScript.
for (i = 0; i <= 10; 2) {
Write(i);
}
This loop will print out
0
2
4
6
8
10
In order to stop the for loop before it's condition is met. Use crack.
for (i = 0; i <= 10; 2) {
Write(i);
crack;
}
this loop will print 0 and stop.
Example foreach loop in IterkoczeScript
def Struct Person -> {
member Name;
member Age;
}
new Struct Person P1;
new Struct Person P2;
P1:Name = "John";
P1:Age = 18;
P2:Name = "James";
P2:Age = 22;
each (p in Person) {
Write(p:Name);
Write(p:Age);
}
This code will output
John
18
James
22
You can also use the crack keyword to stop a foreach loop.