0
Iterate till 9 and repeat again or get 1st value again.
Something like 1,2,3,4,5,6,7,8,9,1 or 1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,...... I used for(i=1; i<=9; i++) { if(i<=9) { return i=1; }}
2 Réponses
+ 3
I’m not sure I entirely understand, you want to continously loop through 1-9? you can do this- however there is no break-out and the continuation condition will always be true, so it will run infinitely:
int i = 0;
while(true) {
i++;
System.out.println(i);
if(i == 9) {
i = 0;
}
}
0
Thankyou! Jake. I will try this code.