Hello Everyone,
I am quite new to Nim and solve puzzles of Advent of Code 2021 using Nim. 🙂 I
enjoy the flexibility, compactness and elegance of the language. Tanks for Nim.
🙏
I ran into a unexpected behavior. The for loop
for i in 1..3: echo i
Run
would iterate over the 3 numbers and print them. However, the loop
for i in 3..1: echo i
Run
does nothing. For me this was completely unexpected (and wasted much of
valuable time in the competition 😉 )
Can anyone explain what is concept behind this asymmetry?
What is the right way to iterate from a .. b if it is unknown, whether a<=b or
a>b ?
Thanks.