3 ms·
1st) you use ++def in a loop, don't be weird; 2nd) if 'abc' is to be used in the loop body, define in the loop, e.g. for (int def = 7, abc =3; ...); 3rd) this i
by xxs 1y ago
1st) you use ++def in a loop, don't be weird; 2nd) if 'abc' is to be used in the loop body, define in the loop, e.g. for (int def = 7, abc =3; ...); 3rd) this is an IntelliJ bug - both 'def' and 'abc' in the sample are always defined.
- pacoverdi 1y ago3) looks like you read 'underlined' as 'undefined'
- xxs 1y agotrue that, thanks!
- sitzkrieg 1y agothe only thing that is weird is your lack of understanding temporary variables
- xxs 1y agoperhaps... yet, Java doesn't have a definition for temporary variables
- throwaway2037 1y ago> you use ++def in a loop, don't be weird I come from a C++ background where it is always advised to use ++i instead of i++. It's just a habit. Does it stress you to read ++i over i++?
- xxs 11mo ago>Does it stress you to read ++i over i++? Of course not, I do use both. Admittedly i++ is a lot more common in Java, and for loops i++ is the standard idiom. Not using the standard idiom usually implies less practice, e.g. str.indexOf('x') < 0 is the standard one, not == -1. Even the backwards iteration is a postfix subtraction:: for (int i = array.length; i-- > 0;) doStuff(array[i]);