初始化仓库,包含format文件,ci, actions和文档。新的路开始了!
This commit is contained in:
16
src/ExampleCodes/2-Function.fig
Normal file
16
src/ExampleCodes/2-Function.fig
Normal file
@@ -0,0 +1,16 @@
|
||||
import std.io;
|
||||
|
||||
func greeting(name:String) -> String
|
||||
{
|
||||
return "Hello " + name + "!";
|
||||
}
|
||||
|
||||
io.println(greeting("Fig"));
|
||||
|
||||
func adder(x)
|
||||
{
|
||||
return func (n) => x + n; // closure
|
||||
}
|
||||
|
||||
const add2 = adder(2);
|
||||
io.println(add2(3));
|
||||
Reference in New Issue
Block a user