Task

Pass a function     as an argument     to another function.



Related task

   First-class functions


 
func g(a: int, b: int, f: func(int,int): int): int
{
    return f(a, b);
}
 
import morfa.base;
 
func main(): void
{
    println("Add: ", g(2, 3, func(a: int, b: int) { return a + b; }));
    println("Multiply: ", g(2, 3, func(a: int, b: int) { return a * b; }));
}
 