2

I wanna have a do loop that runs from the a high number to a smaller one. That is, if we have

Do[Print[n],{n,1,4}]

I would get 1,2,3,4 in the output. I rather wanna have 4,3,2,1. That is, morally I want to implement

Do[Print[n],{n,4,1}]

which doesn't work. How is this implemented?

PhoenixPerson
  • 553
  • 2
  • 10

1 Answers1

4
Do[Print[n], {n, 4, 1, -1}]
(* 4,3,2,1 *)
Ulrich Neumann
  • 53,729
  • 2
  • 23
  • 55