Shorthand IF block

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

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.     }
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Posts: 6230
  • Loc: South-Africa

Post 3+ Months Ago

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) ...

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 61 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.