Announcement

Collapse
No announcement yet.

What Style Do You Code?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

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

  • #2
    I use

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

    Really important question btw .

    Comment


    • #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


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

        Comment


        • #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


          • #6
            Style 1
            NXSupport Admin

            Comment


            • #7
              style 1

              Comment


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

                Comment


                • #9
                  style 1

                  Comment


                  • #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


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

                      Blog | Me

                      Comment


                      • #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


                        • #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


                          • #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


                            • #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...
                              X