Shorthand IF block

  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post November 2nd, 2009, 2:50 pm

Consider this

Code: [ Select ]
    if(is_dir($dir))
    {
        /*
        lots
        of
        stuff
        */
    }
  1.     if(is_dir($dir))
  2.     {
  3.         /*
  4.         lots
  5.         of
  6.         stuff
  7.         */
  8.     }


Wouldn't it be nice if you could do this instead ?

Code: [ Select ]
    is_dir($dir)
    {
        /*
        lots
        of
        stuff
        */
    }
  1.     is_dir($dir)
  2.     {
  3.         /*
  4.         lots
  5.         of
  6.         stuff
  7.         */
  8.     }
Strong with this one, the sudo is.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post November 2nd, 2009, 2:50 pm

  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post November 3rd, 2009, 2:13 am

Yes it would be really awesome ... That makes me think a bit of jQuery's way of doing things ... this is just a lot neater jQuery would be:

Code: [ Select ]
$("#id").click(function(){
 /*
 lots
 of
 stuff
 */
});
  1. $("#id").click(function(){
  2.  /*
  3.  lots
  4.  of
  5.  stuff
  6.  */
  7. });


a function where the result is another function (if that's understandable) ...
Let's leave all our *plum* where it is and go live in the jungle ...

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 133 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.