-2

I would like to know how to make for loops in Nim.

This is my code by far

int i = 1
# for loop expected here

Please help.

1 Answers1

1

You can find this and other versions of for loops in the For statement section of the official Nim Tutorial:

echo "Counting to ten: "
for i in countup(1, 10):
  echo i
# --> Outputs 1 2 3 4 5 6 7 8 9 10 on different lines

To find the tutorial, go to main site at https://nim-lang.org/, click on the learn tab, and finally on the Tutorial, part 1 link.

Grzegorz Adam Hankiewicz
  • 7,349
  • 1
  • 36
  • 78