Showing posts with label brackets. Show all posts
Showing posts with label brackets. Show all posts

Wednesday 20 June 2007

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-))