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. What you say is what you code

What you say is what you code

Scheduled Pinned Locked Moved The Weird and The Wonderful
10 Posts 8 Posters 120 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.
  • R Offline
    R Offline
    Rage
    wrote on last edited by
    #1

    This one gave me a good laugh:

    if (index == 1 || 2)
    {
    ...bla
    }

    The guy was probably on the phone while writing it.

    Company policy : no access to the internet but CP ~RaGE()

    P L J 3 Replies Last reply
    0
    • R Rage

      This one gave me a good laugh:

      if (index == 1 || 2)
      {
      ...bla
      }

      The guy was probably on the phone while writing it.

      Company policy : no access to the internet but CP ~RaGE()

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      Another reason to like C# Perhaps also another argument for the fans of

      if ( 1 == index ) { ... }

      1 Reply Last reply
      0
      • R Rage

        This one gave me a good laugh:

        if (index == 1 || 2)
        {
        ...bla
        }

        The guy was probably on the phone while writing it.

        Company policy : no access to the internet but CP ~RaGE()

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

        When I was a noob programmer I would do things like that.

        if (index == 1 || index == 2)
        ...

        █▒▒▒▒▒██▒█▒██ █▒█████▒▒▒▒▒█ █▒██████▒█▒██ █▒█████▒▒▒▒▒█ █▒▒▒▒▒██▒█▒██

        D R 2 Replies Last reply
        0
        • R Rage

          This one gave me a good laugh:

          if (index == 1 || 2)
          {
          ...bla
          }

          The guy was probably on the phone while writing it.

          Company policy : no access to the internet but CP ~RaGE()

          J Offline
          J Offline
          John R Shaw
          wrote on last edited by
          #4

          Thanks Rage! :laugh::laugh::laugh::laugh: As soon as I open this post a laughed, before even reading it.

          INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

          1 Reply Last reply
          0
          • L Lost User

            When I was a noob programmer I would do things like that.

            if (index == 1 || index == 2)
            ...

            █▒▒▒▒▒██▒█▒██ █▒█████▒▒▒▒▒█ █▒██████▒█▒██ █▒█████▒▒▒▒▒█ █▒▒▒▒▒██▒█▒██

            D Offline
            D Offline
            Dan Neely
            wrote on last edited by
            #5

            I think that's easier to read, and less ambiguous than this since you don't have to wonder if the equals was intended or a strict less than was actually wanted. if ((1 <= index) && (index <= 2))

            -- Rules of thumb should not be taken for the whole hand.

            1 Reply Last reply
            0
            • L Lost User

              When I was a noob programmer I would do things like that.

              if (index == 1 || index == 2)
              ...

              █▒▒▒▒▒██▒█▒██ █▒█████▒▒▒▒▒█ █▒██████▒█▒██ █▒█████▒▒▒▒▒█ █▒▒▒▒▒██▒█▒██

              R Offline
              R Offline
              Russell Jones
              wrote on last edited by
              #6

              am i losing it? what's wrong with that? Russell

              E L M 3 Replies Last reply
              0
              • R Russell Jones

                am i losing it? what's wrong with that? Russell

                E Offline
                E Offline
                Ed Poore
                wrote on last edited by
                #7

                You just have to be careful sometimes because some bizarre languages and/or compilers might have different precedence.  I'm guessing that's what he means, to be safe I for one always put in the braces just to make sure it's doing what I want and not what it wants.

                1 Reply Last reply
                0
                • R Russell Jones

                  am i losing it? what's wrong with that? Russell

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

                  My example was the corrected version.

                  █▒▒▒▒▒██▒█▒██ █▒█████▒▒▒▒▒█ █▒██████▒█▒██ █▒█████▒▒▒▒▒█ █▒▒▒▒▒██▒█▒██

                  R 1 Reply Last reply
                  0
                  • R Russell Jones

                    am i losing it? what's wrong with that? Russell

                    M Offline
                    M Offline
                    Muammar
                    wrote on last edited by
                    #9

                    :laugh::laugh:, you know what?? I had a couple of "???" on my head while reading through these posts until I read your post, only then I thought "ok, I'm not the only one who think's (am I missing something):laugh:


                    Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)

                    1 Reply Last reply
                    0
                    • L Lost User

                      My example was the corrected version.

                      █▒▒▒▒▒██▒█▒██ █▒█████▒▒▒▒▒█ █▒██████▒█▒██ █▒█████▒▒▒▒▒█ █▒▒▒▒▒██▒█▒██

                      R Offline
                      R Offline
                      Russell Jones
                      wrote on last edited by
                      #10

                      hence the full stop at the end of the sentence not a colon. I should check english syntax aswell as code. Thanks for the response. Russ

                      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