closure
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// Test script to verify error positioning
|
||||
"no"();
|
||||
var a := 5;
|
||||
var b := "hello";
|
||||
print 0;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
closure :: fn() do
|
||||
value := "Closure";
|
||||
internal :: fn() do
|
||||
print value;
|
||||
return value;
|
||||
end
|
||||
return internal;
|
||||
end
|
||||
|
||||
internal := closure();
|
||||
internal();
|
||||
@@ -6,23 +6,26 @@
|
||||
//func_name :: fn(param: Number, param2: String) {param is Int} do
|
||||
func_name :: fn(param: Int, param2: String) do
|
||||
print param;
|
||||
cavallo := 5;
|
||||
print cavallo;
|
||||
while cavallo < 10 do
|
||||
cavallo = cavallo + 1;
|
||||
print cavallo;
|
||||
print param2;
|
||||
while param < param2 do
|
||||
param = param + 1;
|
||||
print param;
|
||||
print param2;
|
||||
//break;
|
||||
end
|
||||
if True then do
|
||||
if False then do
|
||||
print "this shoul be stop";
|
||||
return False;
|
||||
return "Hahahaha";
|
||||
end
|
||||
print "this shoud be un other stop";
|
||||
return 42;
|
||||
//return 42;
|
||||
for i := 11; i <= 21; i = i + 1; do
|
||||
print i;
|
||||
print "hello";
|
||||
break;
|
||||
end
|
||||
|
||||
return False or True;
|
||||
end
|
||||
|
||||
func_name(1,2)
|
||||
func_name(1,20)
|
||||
|
||||
@@ -11,10 +11,20 @@ end
|
||||
|
||||
function_fatcoty_factory :: fn() do
|
||||
print "Function Factory Factory";
|
||||
function_factory
|
||||
return function_factory;
|
||||
end
|
||||
|
||||
//function();
|
||||
//function_factory()();
|
||||
function_fatcoty_factory()()();
|
||||
//function_fatcoty_factory()()();
|
||||
clock()
|
||||
|
||||
closure :: fn() do
|
||||
value = "Closure";
|
||||
internal :: fn() do
|
||||
print value;
|
||||
end
|
||||
return internal;
|
||||
end
|
||||
|
||||
closure()
|
||||
|
||||
Reference in New Issue
Block a user