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 := () -> {
  loop {
    line := ().read_line.trim
    line.parse_float.try((
      (n) -> (n)
      () -> ("Error: '", line, "' not a number!").concat.println
    ))
  }
}

("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
