monyet.cc
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Maven (famous) to Programmer Humor@programming.dev • 10 days ago

Modern Programming

lemmy.zip

message-square
76
fedilink
585

Modern Programming

lemmy.zip

Maven (famous) to Programmer Humor@programming.dev • 10 days ago
message-square
76
fedilink
  • oni ᓚᘏᗢ
    link
    fedilink
    11•10 days ago

    I love something = condition and result1 or result2 in lua

    • @Randelung@lemmy.world
      link
      fedilink
      10•
      edit-2
      10 days ago

      Python does that, too.

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

      • @SatyrSack@lemmy.sdf.org
        link
        fedilink
        1•10 days ago

        Are you just referring to how Python uses the English and/or instead of the more common &&/||? I think what the user above you was talking about was Lua’s strange ternary syntax using and/or.

        • lime!
          link
          fedilink
          English
          6•
          edit-2
          10 days ago

          no, the linked table shows how python also returns the first non-falsey result of an a or b expression rather than just giving a boolean. it’s useful for initialising optional reference args:

          def foo(a: list = None)
              a = a or []
          

          works with and as well.

    • oni ᓚᘏᗢ
      link
      fedilink
      1•
      edit-2
      10 days ago

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

Programmer Humor@programming.dev

!programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
  • 765 users / day
  • 4.04K users / week
  • 10K users / month
  • 19.7K users / 6 months
  • 24.4K subscribers
  • 1.52K Posts
  • 56.7K Comments
  • Modlog
  • mods:
  • Feyter
  • adr1an
  • @BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne
  • BE: 0.19.3
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org