5/26/2005

There's SPACE in my CASE

My old way of formatting swtich/case:

switch ($somevar) {
case "abc" : someFunc(); break;
case "t" : otherFunc(); break;
case "z" : yetAnotherFunc();
onemoreFunc();
break;
}

After some thoughts like:
  • Hey, now every time I change the length of some "var" I have to reindent all the stuff. bah.
  • I have to move my cursor alot to add anymore code to the thing
  • My space bar is going to wear out before the rest of the keyboard if I keep this up.
  • Hmm, wonder what the PEAR group does
My new way of indenting switch blocks

switch ($_POST["task"]) {
case "lookup" :
$data = lookup($_POST["lookupValue1"]), $_POST["lookupValue2"]);
displayForm($data);
break;
case "addCake" :
displayForm($data);
displayCakeForm($data);
default:
displayLookup();
}

Like pear group, but the contents are indented.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home