nc

Loops

For loops

for i in 1:20 {
  print(i) // Prints 1, 2, 3, ..., 20
}

for j in 1:2:20 { // You can increment/decrement by other values
  print(j) // Prints 1, 3, 5, ..., 19
}

For loops will always loop over an array:

While loops

mut int j = 2
while j > 0 {
  j--
}
// `j` is available here since it was declared outside