madcat
11-11-2008, 05:42 PM
All of the following examples work without issue. Just wondering which is recommended or best practice. Should any one of these be avoided? Why?
In books, usually the curly braces are used... in practice, I see a lot of advanced coders using the first example...
if (condition) trace("works");
if (condition) { trace("works"); }
if (condition) {
trace("works1");
trace("works2");
trace("works3");
}
if (condition)
trace("works1");
trace("works2");
trace("works3");
Thanks!
In books, usually the curly braces are used... in practice, I see a lot of advanced coders using the first example...
if (condition) trace("works");
if (condition) { trace("works"); }
if (condition) {
trace("works1");
trace("works2");
trace("works3");
}
if (condition)
trace("works1");
trace("works2");
trace("works3");
Thanks!