Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Another Horror

Another Horror

Scheduled Pinned Locked Moved The Weird and The Wonderful
28 Posts 15 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C cpkilekofp

    Narotham Babu Kalluri wrote:

    I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); }

    Since this programmer obviously can't make a switch in code, your company should make a switch of employees.

    L Offline
    L Offline
    Lutoslaw
    wrote on last edited by
    #18

    if (a >= 1 && a <= 4)
    DoSomething(a);

    is a better option than a switch I think :) .

    Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

    C 1 Reply Last reply
    0
    • L Lutoslaw

      if (a >= 1 && a <= 4)
      DoSomething(a);

      is a better option than a switch I think :) .

      Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

      C Offline
      C Offline
      cpkilekofp
      wrote on last edited by
      #19

      gajatko wrote:

      if (a >= 1 && a <= 4) DoSomething(a); is a better option than a switch I think .

      Hmmmm...in this case, yes :)

      V 1 Reply Last reply
      0
      • N Narotham Babu Kalluri

        I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } And this part is written in many places of the application

        D Offline
        D Offline
        dojohansen
        wrote on last edited by
        #20

        LOL

        1 Reply Last reply
        0
        • N Narotham Babu Kalluri

          I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } And this part is written in many places of the application

          D Offline
          D Offline
          dojohansen
          wrote on last edited by
          #21

          That is almost beautiful in it's inelegance! It is hard to come up with something convoluted and still have code that looks like the person writing it didn't try hard to make it as convoluted as possible...

          1 Reply Last reply
          0
          • C cpkilekofp

            gajatko wrote:

            if (a >= 1 && a <= 4) DoSomething(a); is a better option than a switch I think .

            Hmmmm...in this case, yes :)

            V Offline
            V Offline
            VentsyV
            wrote on last edited by
            #22

            And that's why your previous post got voted down.

            C 1 Reply Last reply
            0
            • N Narotham Babu Kalluri

              I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } And this part is written in many places of the application

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #23

              if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } DoSomething(a);

              1 Reply Last reply
              0
              • V VentsyV

                And that's why your previous post got voted down.

                C Offline
                C Offline
                cpkilekofp
                wrote on last edited by
                #24

                VentsyV wrote:

                And that's why your previous post got voted down.

                :laugh: once I start caring, I might start paying attention to the scores.

                V 1 Reply Last reply
                0
                • C cpkilekofp

                  VentsyV wrote:

                  And that's why your previous post got voted down.

                  :laugh: once I start caring, I might start paying attention to the scores.

                  V Offline
                  V Offline
                  VentsyV
                  wrote on last edited by
                  #25

                  That post was for Paul Conrad's benefit really.

                  C 1 Reply Last reply
                  0
                  • V VentsyV

                    That post was for Paul Conrad's benefit really.

                    C Offline
                    C Offline
                    cpkilekofp
                    wrote on last edited by
                    #26

                    VentsyV wrote:

                    That post was for Paul Conrad's benefit really.

                    A pity, then, that it appeared as a reply to MY post. I am an INNOCENT BYSTANDER!! :^)

                    1 Reply Last reply
                    0
                    • N Narotham Babu Kalluri

                      I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } And this part is written in many places of the application

                      C Offline
                      C Offline
                      ChrisKiki
                      wrote on last edited by
                      #27

                      big LOL, maybe this is how the runtime actually works ;P

                      1 Reply Last reply
                      0
                      • N Narotham Babu Kalluri

                        I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); } And this part is written in many places of the application

                        C Offline
                        C Offline
                        cliran
                        wrote on last edited by
                        #28

                        you know what they say.. 'measure twice, cut once'

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups