What Style Do You Code?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CeleronXT
    Senior Member
    • Mar 2002
    • 3217

    What Style Do You Code?

    Just curious what style everyone here codes in.. I myself am style 1.

    Style 1:
    PHP Code:
    if (condition) {
        
    // do something here
     
    } elseif (condition) {
        
    // do something else
     
    } else {
        
    // do something else
     

    Style 2:
    PHP Code:
    if (condition)
       {
        
    // do something here
       
    }
     elseif (
    condition)
       {
        
    // do something else
       
    }
     else
       {
        
    // something else
       

    Style 3:
    PHP Code:
    if (condition) {
        
    // do something here
     
    }
     elseif (
    condition) {
        
    // do something else
     
    }
     else {
        
    // final action
     

    Style 4:
    PHP Code:
     if (condition)
     {
        
    // do something here
     
    }
     else
     if (
    condition)
     {
        
    // do something else
     
    }
     else
     {
        
    // final action
     

    Style 5:
    PHP Code:
      if (condition)
      {
         
    // do something here
      
    }
      else if (
    condition)
      {
         
    // do something else
      
    }
      else
      {
         
    // final action
      

    Last edited by CeleronXT; Sun 14 Sep '03, 11:34am.
    "63,000 bugs in the code, 63,000 bugs, you get 1 whacked with a service pack, now there's 63,005 bugs in the code."
    "Before you critisize someone, walk a mile in their shoes. That way, when you critisize them, you're a mile away and you have their shoes."
    Utopia Software - Current Software: Utopia News Pro (news management system)
  • Icheb
    Senior Member
    • Nov 2002
    • 1291

    #2
    I use

    PHP Code:
    if ($bla) {
       
    // bla
    }
    elseif (
    $bla2) {
       
    // bla2
    }
    else {
       
    // bla3

    Really important question btw .

    Comment

    • CeleronXT
      Senior Member
      • Mar 2002
      • 3217

      #3
      Originally posted by Icheb
      I use
      PHP Code:
      if ($bla) {
      // bla
      }
      elseif (
      $bla2) {
      // bla2
      }
      else {
      // bla3

      Really important question btw .
      Ah yes, style 3.
      "63,000 bugs in the code, 63,000 bugs, you get 1 whacked with a service pack, now there's 63,005 bugs in the code."
      "Before you critisize someone, walk a mile in their shoes. That way, when you critisize them, you're a mile away and you have their shoes."
      Utopia Software - Current Software: Utopia News Pro (news management system)

      Comment

      • Icheb
        Senior Member
        • Nov 2002
        • 1291

        #4
        No, not quite . Notice the slight difference in the ending brackets .

        Comment

        • CeleronXT
          Senior Member
          • Mar 2002
          • 3217

          #5
          Originally posted by Icheb
          No, not quite . Notice the slight difference in the ending brackets .
          The fact that they're indented? That's not something I really meant to do...
          "63,000 bugs in the code, 63,000 bugs, you get 1 whacked with a service pack, now there's 63,005 bugs in the code."
          "Before you critisize someone, walk a mile in their shoes. That way, when you critisize them, you're a mile away and you have their shoes."
          Utopia Software - Current Software: Utopia News Pro (news management system)

          Comment

          • Dimava
            Senior Member
            • Jul 2001
            • 518

            #6
            Style 1
            NXSupport Admin

            Comment

            • Son-Goku
              Member
              • Nov 2002
              • 54

              #7
              style 1

              Comment

              • Beorn
                Senior Member
                • May 2002
                • 451

                #8
                Style 1....saves space and it's neat

                Comment

                • AlphaRider
                  New Member
                  • Mar 2003
                  • 2

                  #9
                  style 1

                  Comment

                  • vB-Host.com
                    Senior Member
                    • Apr 2003
                    • 206

                    #10
                    Code:
                    if (condition) { 
                    ***// This Is My Style 
                    } elseif (condition) { 
                    ***// It Is Neat and clean 
                    } else { 
                    ***// along with being old school 
                    } 
                    //////////////////////////////////////////////////
                    // if (code fail) get=$goto-bed ()
                    //	finish in one month
                    //////////////////////////////////////////////////

                    Comment

                    • Jerry
                      Senior Member
                      • Dec 2002
                      • 9137
                      • 1.1.x

                      #11
                      Depends on the language/version and who is paying me and how much
                      I wrote ImpEx.

                      Blog | Me

                      Comment

                      • CeleronXT
                        Senior Member
                        • Mar 2002
                        • 3217

                        #12
                        Originally posted by Jerry
                        Depends on the language/version and who is paying me and how much
                        Ok, well how do you code Jelsoft products?
                        "63,000 bugs in the code, 63,000 bugs, you get 1 whacked with a service pack, now there's 63,005 bugs in the code."
                        "Before you critisize someone, walk a mile in their shoes. That way, when you critisize them, you're a mile away and you have their shoes."
                        Utopia Software - Current Software: Utopia News Pro (news management system)

                        Comment

                        • Chen
                          Senior Member
                          • Jun 2001
                          • 8388

                          #13
                          The new standard for vBulletin is style 2 without the spaces in front of brackets.
                          Chen Avinadav
                          Better to remain silent and be thought a fool than to speak out and remove all doubt.

                          גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

                          Comment

                          • Freddie Bingham
                            Former vBulletin Developer
                            • May 2000
                            • 14057
                            • 1.1.x

                            #14
                            Originally posted by Chen
                            The new standard for vBulletin is style 2 without the spaces in front of brackets.
                            Yes but I always use "else if" instead of "elseif". At least until Kier declares that I must use the second even though it makes no sense to me since "elseif" isn't a word.

                            Comment

                            • CeleronXT
                              Senior Member
                              • Mar 2002
                              • 3217

                              #15
                              You mean "else if" really works? I never knew that.. :O
                              "63,000 bugs in the code, 63,000 bugs, you get 1 whacked with a service pack, now there's 63,005 bugs in the code."
                              "Before you critisize someone, walk a mile in their shoes. That way, when you critisize them, you're a mile away and you have their shoes."
                              Utopia Software - Current Software: Utopia News Pro (news management system)

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...