• recursive_recursion [they/them]@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    1 year ago

    modulo

    pseudocode:

    if number % 2 == 0
      return "number is even" (is_num_even = 1 or true)
    else
      return "number is odd" (is_num_even = 0 or false)
    

    plus you’d want an input validation beforehand

    • Vex_Detrause@lemmy.ca
      link
      fedilink
      arrow-up
      0
      ·
      1 year ago
      #You are an input. You have value! You matter!
      if number % 2 == 0
        return "number is even" (is_num_even = 1 or true)
      else
        return "number is odd" (is_num_even = 0 or false)
      

      Am I doing it right? /S.