diff --git a/ExampleCodes/2-Function.fig b/ExampleCodes/2-Function.fig new file mode 100644 index 0000000..9f3620c --- /dev/null +++ b/ExampleCodes/2-Function.fig @@ -0,0 +1,15 @@ +func greeting(name:String) -> String +{ + return "Hello " + name + "!"; +} + +const print := __fstdout_println; // link to std out +print(greeting("Fig")); + +func adder(x) +{ + return func (n) => x + n; // closure +} + +const add2 = adder(2); +print(add2(3)); \ No newline at end of file