r/learnprogramming • u/just_jesse • Jul 12 '13
What are some bad coding habits you would recommend a beginner avoid getting into?
Whether they're stylistic habits or program design habits. I'm learning java and want to be sure to write my code as efficiently as possible to avoid lengthy code and poor design choices.
249
Upvotes
View all comments
Show parent comment
7
u/deuteros Jul 12 '13 edited Jul 12 '13
Except in this case you've just created an infinite loop if your search condition is never satisfied.
Here's an example of when a break statement would be appropriate: