Agreed. There are times when ()'s and {}'s are not necessary and there are times when they are. When your script suddenly doesn't work and you are doing the same thing as you always did (not using parentheses and braces), you will be stuck for quite awhile with no idea that it's because you didn't use them in a particular situation. Instead, being in the habit of using them will always keep you from running into such a situation.

There have been comments regarding speed of using them vs. not using them and the speed is so minimal that it isn't noticeable until you are talking about trying to run thousands of lines that use them within a couple of seconds. Even then, you're still looking at milliseconds of difference, which isn't important.

So, since speed isn't really an issue and it's better to be in the habit of using them to prevent problems when they won't work, it is a good idea to always promote using them to new scripters rather than promoting not using them.

The only time I won't use {}'s are on certain ELSE lines where there is only one command for the ELSE. Even then, I may still use them just to make things more clear.

Of course, there is a such thing as overuse of ()'s. Too many ()'s make things confusing as well.

These are fine:
if (this == that || this == that) { }
if (this == that) || (this == that) { }

But, this starts to become too much, imo:
if ((this == that) || (this == that)) { }

Personally, I prefer the first of those 3 examples.


Invision Support
#Invision on irc.irchighway.net