Tin

Examples · learn/04-control · 95 of 339

for-range

examples/learn/04-control/for-range.tintin run examples/learn/04-control/for-range.tin
fn main() {
  for i in 0..3 {               // 0, 1 and 2: the end is not included
    print("lap {i}")
  }
  var total = 0
  for n in 1..101 {
    total += n
  }
  print("1 + 2 + ... + 100 = {total}")
}