gcd := vals -> {
  ().loop(() -> {
    (a, b) := vals
    if a.eq(b)
      (a)
    else if b.subtract(a).signum.eq(1)
      &vals = (a, b.subtract(a))
    else
      &vals = (a.subtract(b), b)
  })
}

get_num := () -> {
  line := ().read_line.trim
  (
    line.parse_float,
    (
      () -> {
        ("error: '", line, "' not a number!").concat.println
        1.panic
      }
      n -> n,
    )
  ).try
}

("gcd of 899 and 2900 is ", (899, 2900).gcd).concat.println // 29
"Now type two numbers!".println
(a, b) := (().get_num, ().get_num)
("gcd of ", a, " and ", b, " is ", (a, b).gcd).concat.println
