tlang-c/examples/recursive_files.tlang

12 lines
574 B
Plaintext

func list_dir(path)
{
each(dir : fs.enumerate_dirs())
}
//functions can also be defined like this
//list_dir = func(path) {}
//they can also dont require scopes
//my_func = func(a,b) a + b;
//there is no return keyword you (its the last expression in function)
//they can also be used like lambda: somefunc(95,func(a,b) a + b);
//they can have optional arguments like this (if it is not set, the value will be equal to undefined): func(requiredArg,$optional)
//this language also supports Variadic functions it looks like this: func($$somelist){ len = somelist.length;}