r/learnjava • u/stackchief • Aug 08 '18
Making code make decisions ...
Control flow is central to making decisions in Java. Mastering control flow makes it possible to make decisions with code ...after all that’s why we write code:
2
Upvotes
9
u/desrtfx Aug 08 '18
This is not entirely correct and dangerous advice.
Should be:
You should really emphasize that this is considered bad practice and actually against the Official Oracle Code Conventions for the Java Programming Language (section 7.4) and the Google Java Style (section 4.1.1)
This is called enhanced
for. You need to make clear that this way is read only! The elements in the array cannot be changed with an enhancedforloop.Please, please make it clear that this should not really be used! Labeled breaks are the new
goto. They commonly are a huge code smell and debugging hell.Other than the above, this time you managed to get a somewhat decent tutorial together. You're improving.