next element is (current+1) or 0 (ruby)
- by Radek
I have an interval let's say (0..3) where next element is +1 unless the last. Then the next is 0. I solved it by the code below. Just wondering if there is anything else outhere :-)
def next(max,current)
if current+1 == max
return 0
else
return current+1
end
end