I need to make something in my code that will repeat the code until (i) is less or equal to 0, or until (n) is less or equal to zero.
repeatUntil(i <= 0, OR n <= 0);
something along those lines
I need to make something in my code that will repeat the code until (i) is less or equal to 0, or until (n) is less or equal to zero.
repeatUntil(i <= 0, OR n <= 0);
something along those lines
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson
Code:a: if (i <= 0 || n <= 0) goto b; /* Do stuff here */ goto a; b: /* Now outside of loop */
No, you should stay away from goto statements!
while, or do while loops are the proper way to repeat code until a specific condition. for loops if you know the number of iterations.
Please read the link in @stahta01's post #2