If I type in the code with the word "test" then the word "test" prints out 9 times (as intended). If I type in the code with the word "test 2", "test 2" only prints out 3 times. Why is this (why does it print out 3 times, and not 9 times)?
for (int a1 = 3; a1 > 0; a1--) {
for (int a0 = 3; a0 > 0; a0--) {
System.out.println("test");
}
}
// Second version of code below
int a1 = 3;
int a0 = 3;
for (; a1 > 0; a1--) {
for (; a0 > 0; a0--) {
System.out.println("test 2");
}
}
a0remains0so the inner loop doesn't run any more.