0
Could someone explain, what is actually happening there?
2 Answers
+ 7
Your code runs an infinite loop. It happens because you increment <num> by one, until <num> becomes 6, where an `if` block decremented <num> to 5. This happens over and over.
+ 4
Its quite simple:
once num reaches 5 it gets increased up to six first
then as it is already six if(num==6) is true
then because of num= num-1;
num gets decreased back to 5
and loop repeats itself for infinity....