int result = 0;
for (int i = 0; i < 4; i++) {
result += 3;
}
System.out.println(result);
vs
int result = 0;
int i = 0;
while (true) {
result += 3; // shorthand for result = result + 3
i++; // shorthand for i = i + 1
if (i == 4) {
break;
}
}
System.out.println(result);
why in the first one when we use i < 4 it prints out 12 but in the second one i == 4 prints out the same thing