No brackets !
Let's have:
if (condition)
doSomething();
And later, add doOtherThing() method to the condition.
if (condition)
doSomething();
doOtherThing();
And later, it appends. Ooops. I forgot the brackets.
So, I don't know why it is not required in every languages, BUT you MUST always use brackets.
if (condition) {
doSomething();
}
And then
if (condition) {
doSomething();
doOtherThing();
}
This time I didn't forget the brackets 8-))
1 comment:
Stupid code or stupid developer?
You could just (oh say) format the code before committing (good practice) and look at the code (good practice).
Also, your JUnit test (best practice) would catch the problem.
Post a Comment