Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
downto
If you're not sure how to loop downwards, downto is usually the one to go for. Instead of:
for i=0 to 1000 do Printf.printf"%d "(1000-i) done
You can do:
for i=1000 downto 0 do Printf.printf"%d "i done
for i=0 to 1000 Printf.printf"%d "(1000-i)
for i=1000 downto 0 Printf.printf"%d "i