Loops and iterations - IUrixl/Kova GitHub Wiki
A repeat loop not intended to be used with iterator, its iterator variable will always be %%A and cannot be changed.
repeat <init> <limit> -> {
}
Argument | Definition |
---|---|
Init | Init of the range iterator |
Limit | Limit that the iterator must reach |
define main -> {
repeat 0 10 -> {
print "This is a loop"
}
}
Using unsafe labels AKA "codePointers" to make custom and unsafe loops within safe labels.
define main -> {
.unsafe
print "Unsafe loop"
point unsafe
}
Just like C++ you can add or substract 1 from a variable typing less.
++ <variable>
-- <variable>
Argument | Definition |
---|---|
Variable | Name of the variable to modify |
define main -> {
var x 20
// Sum 15 times 1 to x
repeat 0 15 -> {
++ x
}
print "%x%"
// Substact 25 times 1 to x
repeat 0 25 -> {
-- x
}
print "%x%"
}