Ah, loops, so useful, so many! Here I will show you how to use different loops. Now lets go over the types:
- @loop
- Repeat loop
- while loop
- for loop
Lets start now!
@Loop
Ok I
DONT recomend this one, it is less efficient, but that doesnt really matter now. You can have a loop that looks like this:
ACLS
@LOOP
'Some code
WAIT 1
GOTO@LOOP
Thats basically it, but this is not a recommended loop.
Repeat loop
Yes, a repeat loop. This one is basically (bad pun) a loop that repeats until the specified condition(s) is/are satisfied. Ex:
ACLS
REPEAT
'Some code
UNTIL 'Condition that should be satisfied
So theres that.
While loop
This is basically (again) the repeat loop reversed, while a condition is satisfied, it loops. Here is an example:
ACLS
WHILE 'Conition that is satisfied
'Some code
WEND
so thats that.
For loop
This one is kinda useful, like for loading maps, but basically (AGAIN) is a loop where a variable is equal to a value and the loop repeats until the variable is equal to an other value. I dont think you can change the value while its looping, but when it loops the value increases/decreases depending on if the value is bigger or smaller than the other value until it is equal to the other value. it then stops looping and the value is still equal to the second value. Also if you put STEP then a number, it will change the amount that the variable is changing by, by the number after step.
eg:
ACLS
FOR I=0 TO 3
'Some code
NEXT
ACLS
FOR I=0 TO 4 STEP 2
'Some code
WEND
additional stuff
Also with the while/repeat loops u can do this for infinint looping. remember they are different:
ACLS
WHILE 1'This!
'Some code
WEND
ACLS
REPEAT
'Some code
UNTIL 0'Here!
bananaโโโ