Even Odd in Pyret

Published on 26 December 2023 (Updated: 01 January 2024)

Welcome to the Even Odd in Pyret page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

import cmdline-lib as CL

usage = "Usage: please input a number\n"
args = CL.command-line-arguments()
cases(Option) string-to-number(if args.length() > 1: args.get(1) else: "" end):
  | none => print(usage)
  | some(n) =>
    if not(num-is-integer(n)): print(usage)
    else if num-modulo(n, 2) == 0: print("Even\n")
    else: print("Odd\n")
    end
end

Even Odd in Pyret was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.