Not anymore! If you have a single expression following a control structure, you do not need to waste your time with brackets { }.
if ($gollum == 'halfling') {
$height --;
}Is the same as:
if ($gollum == 'halfling') $height --;This can be applied to any control structure statement. For example:
if ($gollum == 'halfling') $height --;
else $height ++;
if ($frodo != 'dead')
echo 'Gosh darnit, roll again Sauron';
foreach ($kill as $count)
echo 'Legolas strikes again, that makes' . $count . 'for me!';The fewer brackets you have cluttering up your code, the easier it may be to read.

No comments:
Post a Comment