View Single Post
  #74  
Old 05-04-2011, 11:38 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by oo_jazz_oo View Post
Actually, having single like script blocks within if() or loops is common.

The problem in this case is he was asking about a function without brackets.

PHP Code:
function onCreated() {
  if (
foo == bar) return true;
}
function 
onPlayerEnters() {
  for (
pl:players)
    
pl.chat "Welcome!";

Both of which are used commonly. At that point, I think its a matter of preference whether you include brackets for 1 line codes.
Please don't teach people to exclude braces for one-line statements . It's a hard habit to break, and it just makes it a pain when you try to change code later.
__________________
Reply With Quote