Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • 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
Brand Logo

agnos.is Forums

  1. Home
  2. Programmer Humor
  3. Modern Programming

Modern Programming

Scheduled Pinned Locked Moved Programmer Humor
programmerhumor
74 Posts 46 Posters 2 Views
  • 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.
  • maven@lemmy.zipM This user is from outside of this forum
    maven@lemmy.zipM This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #1
    This post did not contain any content.
    S capuccino@lemmy.worldC entropicdrift@lemmy.sdf.orgE scrubbles@poptalk.scrubbles.techS P 9 Replies Last reply
    521
    • maven@lemmy.zipM [email protected]
      This post did not contain any content.
      S This user is from outside of this forum
      S This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #2

      Please. That's C's ternary operator. JS is just a pile of garbage cosplaying as a programming language

      V 1 Reply Last reply
      50
      • maven@lemmy.zipM [email protected]
        This post did not contain any content.
        capuccino@lemmy.worldC This user is from outside of this forum
        capuccino@lemmy.worldC This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #3

        I love something = condition and result1 or result2 in lua

        capuccino@lemmy.worldC R 2 Replies Last reply
        8
        • capuccino@lemmy.worldC [email protected]

          I love something = condition and result1 or result2 in lua

          capuccino@lemmy.worldC This user is from outside of this forum
          capuccino@lemmy.worldC This user is from outside of this forum
          [email protected]
          wrote on last edited by [email protected]
          #4

          often I do a function called elvis XD with the next signature elvis(condition, res1, res2)

          1 Reply Last reply
          0
          • maven@lemmy.zipM [email protected]
            This post did not contain any content.
            entropicdrift@lemmy.sdf.orgE This user is from outside of this forum
            entropicdrift@lemmy.sdf.orgE This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #5
            print("odd" if num % 2 else "even")
            

            That's the native python version, for those curious

            G K D L 4 Replies Last reply
            120
            • maven@lemmy.zipM [email protected]
              This post did not contain any content.
              scrubbles@poptalk.scrubbles.techS This user is from outside of this forum
              scrubbles@poptalk.scrubbles.techS This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #6

              Peak programming

              1 Reply Last reply
              9
              • entropicdrift@lemmy.sdf.orgE [email protected]
                print("odd" if num % 2 else "even")
                

                That's the native python version, for those curious

                G This user is from outside of this forum
                G This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #7

                That's way too non-convoluted enough

                entropicdrift@lemmy.sdf.orgE 1 Reply Last reply
                9
                • capuccino@lemmy.worldC [email protected]

                  I love something = condition and result1 or result2 in lua

                  R This user is from outside of this forum
                  R This user is from outside of this forum
                  [email protected]
                  wrote on last edited by [email protected]
                  #8

                  Python does that, too.

                  https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not

                  satyrsack@lemmy.sdf.orgS 1 Reply Last reply
                  7
                  • G [email protected]

                    That's way too non-convoluted enough

                    entropicdrift@lemmy.sdf.orgE This user is from outside of this forum
                    entropicdrift@lemmy.sdf.orgE This user is from outside of this forum
                    [email protected]
                    wrote on last edited by
                    #9

                    Python is kinda like that in general, unless you try to make it read like ass

                    C W 2 Replies Last reply
                    14
                    • maven@lemmy.zipM [email protected]
                      This post did not contain any content.
                      P This user is from outside of this forum
                      P This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #10

                      Yeah... I played that "serial killer or programming language inventor" game.

                      The only one I was completely in disagreement with was the inventor of Python. He's definitely a mass-murderer

                      C 1 Reply Last reply
                      9
                      • maven@lemmy.zipM [email protected]
                        This post did not contain any content.
                        kn0wmad1c@programming.devK This user is from outside of this forum
                        kn0wmad1c@programming.devK This user is from outside of this forum
                        [email protected]
                        wrote on last edited by [email protected]
                        #11

                        num % 2 isn't a boolean result in any of these languages, so I feel like it would always output "odd"

                        Edit: 0 is false, everything else is true.

                        maven@lemmy.zipM moomoomoo309@programming.devM C K M 6 Replies Last reply
                        2
                        • entropicdrift@lemmy.sdf.orgE [email protected]

                          Python is kinda like that in general, unless you try to make it read like ass

                          C This user is from outside of this forum
                          C This user is from outside of this forum
                          [email protected]
                          wrote on last edited by
                          #12

                          Clearly an inferior language. /s

                          1 Reply Last reply
                          3
                          • kn0wmad1c@programming.devK [email protected]

                            num % 2 isn't a boolean result in any of these languages, so I feel like it would always output "odd"

                            Edit: 0 is false, everything else is true.

                            maven@lemmy.zipM This user is from outside of this forum
                            maven@lemmy.zipM This user is from outside of this forum
                            [email protected]
                            wrote on last edited by
                            #13

                            In JS 0 is the same as False

                            L 1 Reply Last reply
                            2
                            • kn0wmad1c@programming.devK [email protected]

                              num % 2 isn't a boolean result in any of these languages, so I feel like it would always output "odd"

                              Edit: 0 is false, everything else is true.

                              moomoomoo309@programming.devM This user is from outside of this forum
                              moomoomoo309@programming.devM This user is from outside of this forum
                              [email protected]
                              wrote on last edited by
                              #14

                              All of those languages will convert numbers into booleans, 0 is false, all other numbers are true.

                              kn0wmad1c@programming.devK 3 Replies Last reply
                              7
                              • kn0wmad1c@programming.devK [email protected]

                                num % 2 isn't a boolean result in any of these languages, so I feel like it would always output "odd"

                                Edit: 0 is false, everything else is true.

                                C This user is from outside of this forum
                                C This user is from outside of this forum
                                [email protected]
                                wrote on last edited by
                                #15

                                The joys of dynamic typing.

                                1 Reply Last reply
                                1
                                • moomoomoo309@programming.devM [email protected]

                                  All of those languages will convert numbers into booleans, 0 is false, all other numbers are true.

                                  kn0wmad1c@programming.devK This user is from outside of this forum
                                  kn0wmad1c@programming.devK This user is from outside of this forum
                                  [email protected]
                                  wrote on last edited by
                                  #16

                                  Ah, that makes sense.

                                  1 Reply Last reply
                                  0
                                  • kn0wmad1c@programming.devK [email protected]

                                    num % 2 isn't a boolean result in any of these languages, so I feel like it would always output "odd"

                                    Edit: 0 is false, everything else is true.

                                    K This user is from outside of this forum
                                    K This user is from outside of this forum
                                    [email protected]
                                    wrote on last edited by
                                    #17

                                    0 is false in C, Python, and JS. It should work

                                    1 Reply Last reply
                                    6
                                    • kn0wmad1c@programming.devK [email protected]

                                      num % 2 isn't a boolean result in any of these languages, so I feel like it would always output "odd"

                                      Edit: 0 is false, everything else is true.

                                      M This user is from outside of this forum
                                      M This user is from outside of this forum
                                      [email protected]
                                      wrote on last edited by
                                      #18

                                      You'd be surprised.

                                      But seriously, numbers can be used as booleans in an impressive number of languages. Including machine code for almost every machine out there.

                                      1 Reply Last reply
                                      1
                                      • entropicdrift@lemmy.sdf.orgE [email protected]
                                        print("odd" if num % 2 else "even")
                                        

                                        That's the native python version, for those curious

                                        K This user is from outside of this forum
                                        K This user is from outside of this forum
                                        [email protected]
                                        wrote on last edited by
                                        #19

                                        Why is the return first?

                                        J B 2 Replies Last reply
                                        7
                                        • moomoomoo309@programming.devM [email protected]

                                          All of those languages will convert numbers into booleans, 0 is false, all other numbers are true.

                                          kn0wmad1c@programming.devK This user is from outside of this forum
                                          kn0wmad1c@programming.devK This user is from outside of this forum
                                          [email protected]
                                          wrote on last edited by
                                          #20

                                          That makes sense. However, num % 2 equaling 0 would mean it's even, and not "odd" like the ternary operator is outputting, yeah?

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


                                          • Login

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