Iterate over a range in a non standard way

Just writing explicit loops seems like it would be a lot easier than defining an iterator.

But even easier and more explicit would be to sort your range by how far the elements are from your target value of 90:

julia> sort(10:100, by=n->abs(n-90))
91-element Vector{Int64}:
 90
 89
 91
 88
 92
 87
 93
 86
  ⋮
 16
 15
 14
 13
 12
 11
 10
7 Likes