+ 1
What's the difference between these?
int y = 15; while(y > 0) { System.out.println(y); y--; } and this for(int x = 15; x > 0; x--) { System.out.println(x) }
3 Answers
0
i changed my name cuz it was cringe One main difference is for loop use for fix iteration.
+ 2
There is no difference, from there you can see how write one problem with 2or more cycles (for, while, do while)
Also you write this example with do while, and use which is better for you
+ 2
There is no difference
In the first: state u use while loop
In the second :state u use for loop