LibreTechni.ca
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
irelephant [he/him]@lemmy.dbzer0.com to Programmer Humor@programming.dev · 17 hours ago

: (

lemmy.dbzer0.com

message-square
29
fedilink
256

: (

lemmy.dbzer0.com

irelephant [he/him]@lemmy.dbzer0.com to Programmer Humor@programming.dev · 17 hours ago
message-square
29
fedilink
  • Hadriscus@jlai.lu
    link
    fedilink
    arrow-up
    11
    ·
    17 hours ago

    What do you use instead of booleans ? floats ?

    • The Ramen Dutchman@ttrpg.network
      link
      fedilink
      arrow-up
      1
      ·
      2 hours ago

      Smallest INT it can support and only ever use 0 and 1.

    • MultipleAnimals@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      42
      ·
      17 hours ago

      strings “true” and “false” ofc like any sane developer

      • Valmond@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        21
        ·
        15 hours ago

        I got a better one: O for true and N for false.

        Seen in production for quite important stuff (payment requests).

        O is from Oui, N from Non, of course!

        😐🫤

      • Hadriscus@jlai.lu
        link
        fedilink
        arrow-up
        26
        ·
        17 hours ago

        good fucking god

        • kubica@fedia.io
          link
          fedilink
          arrow-up
          30
          ·
          17 hours ago

          it allows for mood changes, some parts of the code can check charAt(0) == 't'others can do val != 'false' just let it flow.

          • Hadriscus@jlai.lu
            link
            fedilink
            arrow-up
            22
            ·
            17 hours ago

            lord mary joseph make it stop

            • sznowicki@lemmy.world
              link
              fedilink
              arrow-up
              19
              ·
              17 hours ago

              And for double fun if the output doesn’t matter you can make if endsWith(“e”).

    • deadbeef79000@lemmy.nz
      link
      fedilink
      arrow-up
      11
      ·
      edit-2
      16 hours ago

      Use a CHAR(1) you can then use it as an enumeration.

      Don’t use T/F for true/false use it for the actual sematic meaning for the thing that the Boolean is toggling. E g. S for subscribed, U for unsubscribed, or whatever.

      It also means when you inevitably grow to needing a tri-state it makes sense.

      Unless SQLite actually supports enumerations, then just use them

      • SpaceNoodle@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        16 hours ago

        I think you could use a CHECK constraint to effectively create en enum

    • irelephant [he/him]@lemmy.dbzer0.comOP
      link
      fedilink
      arrow-up
      9
      ·
      16 hours ago

      Sometimes it’s 0 and 1

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
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 2.13K users / day
  • 4.48K users / week
  • 8.1K users / month
  • 17.6K users / 6 months
  • 1 local subscriber
  • 31.3K subscribers
  • 1.23K Posts
  • 23.5K Comments
  • Modlog
  • mods:
  • adr1an@programming.dev
  • Feyter@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.5
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org