On a few occasions I have seen an arrow like symbol combination being used in a for loop like such:
for(int i = 100; i --> 0;) {
System.out.println(i);
}
What's happening here?
On a few occasions I have seen an arrow like symbol combination being used in a for loop like such:
for(int i = 100; i --> 0;) {
System.out.println(i);
}
What's happening here?
This is not an arrow, but a decrement operator followed by a greater than sign.
What the compiler sees is a less clear version of (i--) > 0
It's the post-decrement operator along with the greater than symbol combined which is confusing and unreadable.
it's the same as writing:
for(int i = 100; (i--) > 0;) { ... }
i.e. i --> 0
is essentially (i--) > 0
.