View Single Post
  #5  
Old 05-05-2011, 01:26 AM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by oo_jazz_oo View Post
I dont see a huge problem in using one line codes without brackets for certain instances.
PHP Code:
function check(xy) {
  if (
== y) return true;

Like in that instance. Does it really make it any more readable...any more efficient...any more anything by adding the brackets?
Bad example because if you're going to take shortcuts, take the best shortcut.

PHP Code:
function check(xy) {
  return 
temp.== temp.y;

In general, I try to always include brackets for one-line statements. Consistency not only improves readability (imo), but it makes your code a lot less error-prone.

If you start saying "oh, well in this instance is it really a problem?" your styling is probably very confusing and inconsistent, and you're much more likely to **** up.
__________________
Reply With Quote