Loops
REDscript supports two types of loops: while
and for..in
.
Unlike Swift, REDScript does not support continue
. If you want to skip a loop, you need to execute it in a function and return
.
while
You can use the while
statement to repeatedly execute a block of code as long as a condition is true. This is similar to how it works in many other languages. For example, you can use a while loop to print each element of an array:
for..in
You can use the for..in
statement to iterate through all the elements of an array one by one. It's often cleaner than using an explicit while
loop:
Last updated