I need to create a procedure to sum `a` and `b` (for study purposes). Variable `a` can be `int` or `float`, variable `b` can be `int` or `float` too.
My code works, but I wonder if there is more simple way to do overloading: proc sum(a: int, b: int): int = a + b proc sum(a: int, b: float): float = float(a) + b proc sum(a: float, b: int): float = a + float(b) proc sum(a: float, b: float): float = a + b echo sum(1, 2) echo sum(1.0, 2) echo sum(1, 2.0) echo sum(1.0, 2.0) Run Orlean