How can I count number of steps between different numbers.
I have a method that takes a number and runs a code snippet with the number. I need to see if the number is the number right next to the other or two steps, three steps, four steps over or below etc.
Ex. I send a number of 1 to the method. The next number sent is 4. I then need to find out how many steps over one it is etc in this case 3 steps over 1 should be the result.
Any clues?
You can use a function with a closure:
See an example fiddle here.