• jcg@halubilo.social
    link
    fedilink
    arrow-up
    2
    ·
    7 hours ago

    Huh, I had never considered this solution to fizzbuzz to be honest. I usually go for string concatenation, or (i % 3 == 0 && i % 5 == 0), but yeah i % 15 == 0 is certainly a clever simplification

    • Bogasse@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      7 hours ago

      I think it’s worse at conveying the intention and should be a compile-time simplification (I’m too lazy to check if compilers would do it though).