Maybe would be great if, for example, 3:1 generates a reverse range ( 3 2 1 )
julia> for i in 1:3
println(i)
end
1
2
3
julia> for i in 3:1
println(i)
end
You can do 3:-1:1 and get that. It can be convenient that the loop doesn't run for 3:1. If you want it to run from n to 3 then if n>3 the loop just doesn't run instead of reversing.
Thanks!! I forget about the each field.
Most helpful comment
You can do
3:-1:1and get that. It can be convenient that the loop doesn't run for3:1. If you want it to run fromnto3then ifn>3the loop just doesn't run instead of reversing.