How would I go about making a function so that x
has a range of values from x=0
to x=19
and if the x
value exceeds 19 or is below zero how can I get it to wrap around
From:
x=20, x=21, x=22
and x=(-1), x=(-2), x=(-3)
To:
x=0, x=1, x=2
and x=19, x=18, x=17
respectively?
I've heard of modular arithmetic which is apparently the way I should deal with it.