• jaybone@lemmy.world
      link
      fedilink
      arrow-up
      2
      arrow-down
      1
      ·
      8 months ago

      Yeah that should be last bit, not last digit lol.

      For another convoluted impl you could do some kind of string format print into a string. Then do your if/else comparing that string containing the last digit. Maybe create a hash set collection of all single digit even strings, then you’ve got O(1) performance using a contains() method.