class OverloadTesting def main assert .sum(1, 1) == 2 def sum(x as int, y as int) as number return .sum(x, y, false) def sum(x as int, y as int, divideByTwo as bool) as number time = 0.0 return .sum(x, y, out time, divideByTwo) def sum(x as int, y as int, time as out number) as number return .sum(x, y, out time, false) def sum(x as int, y as int, time as out number, divideByTwo as bool, msg as String? = nil) as number sw = Diagnostics.Stopwatch() sw.start val as number = x + y if divideByTwo, val /= 2 sw.stop time = sw.elapsedMilliseconds if msg is not nil, print msg return val