So, lets say I have this for loop. i will be the counter and x will be the max value to count towards.
The main problem is that i can be higher or lower than x, and rather than counting up or down, it should count towards x, much like mathf.lerp does.
I know I could use a couple of if statements to determine whether i is higher or lower than x, then use 2 different for loops for those 2 scenarios, but this seems very messy.
Is there a more elegant way of doing this?
A nice way to go through all elements in a 2D array that are in a rectangular path between point a and b would work too, as that is what I’m trying to use it for.
I’m probably overthinking the problem here so there might be some super easy way to do this that I just can’t seem to think of, haha.