IF Statement to count number of rotations?

Hi All,

I have a position sensor which outputs angles of an axle rotation from 0-359 degrees.
The axle will continuously rotate clockwise until a strap attached has been fully unwound.
The sample rate is 50Hz for the sensor which can quickly pass from 0-359 degrees and back through the cycle again.
Is there a possible IF statement or (If Else) that can be created to count the number of rotations from the axle or is there a better way of calculating this?
I'm trying to figure a way of making the system compare the angle to the previous reading but how can it be defined to count 1 rotation once it passes 359 degrees and continues onto 0 and onwards?

UnoProject

Do not double post

If the sensor outputs a value between 0 and 359 then resets back to 0 you can count the number of times that the reading becomes 0 as the number of rotations

If the sensor reading does not start at 0 then save its start value and count how many times the reading becomes that instead.