RosettaCodeData/Task/Even-or-odd/OCaml/even-or-odd-3.ml
2024-10-16 18:07:41 -07:00

8 lines
211 B
OCaml

(* hmm, only valid for N >= 0 *)
let rec myeven = function
| 0 -> true
| 1 -> false
| n -> myeven (n - 2)
(* and here we have the not function in if form *)
let myodd n = if myeven n then false else true