Suppose I have a switch case scenario and a variable, var which records a value from a for-loop as such:
1st loop: var=102nd loop: var=93rd loop: var=94th loop: var=85th loop: var=86th loop: var=87th loop: var=88th loop: var=89th loop: var=8
When any value (in this case 8) is repeated for 3 times, I need to switch from case 1 to case 2. Now the question is, how can I check if a value is repeated 3 times?
In the case above, the first switch is performed when the value 8 is repeated 3 times (4th-6th iteration); and the second switch is performed the next series of value 8 is repeated for 3 times (7th-9th iteration).
Best Answer