• juliebean@lemm.ee
    link
    fedilink
    English
    arrow-up
    46
    ·
    2 years ago

    what would be the alternative? to always execute if the condition is true, but sometimes execute it even when false, for funsies?

    • General_Effort@lemmy.world
      link
      fedilink
      English
      arrow-up
      5
      ·
      2 years ago

      In normal parlance, “if and only if” rules out that something could also happen as a result of other circumstances. EG, if you fall out of a plane, you will lose your glasses. But there are other conditions that would lead to the same result.

      In code, the alternative would be to have a different if statement that executes identical code. Or *cough* you could use a jump instruction to execute literally the same code.

    • unmagical@lemmy.ml
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 years ago

      Brb, making a truly “if” statement function in my products code base for funsies.