Tin

Examples · learn/04-control · 94 of 339

for-items

examples/learn/04-control/for-items.tintin run examples/learn/04-control/for-items.tin
fn main() {
  for word in ["red", "green", "blue"] {
    print(word.upper())
  }
  for i, word in ["red", "green", "blue"] {   // with the position, from 0
    print("{i}: {word}")
  }
}