Procedure Literal

This commit is contained in:
gingerBill
2016-07-22 16:09:49 +01:00
parent 86c083535f
commit f8fd6fce0b
7 changed files with 124 additions and 47 deletions
-5
View File
@@ -1,5 +0,0 @@
import "test"
add :: proc(a, b: int) -> int {
return a + b;
}
+18 -2
View File
@@ -1,11 +1,27 @@
import "other"
// import "other"
TAU :: 6.28;
PI :: PI/2;
type AddProc: proc(a, b: int) -> int;
do_thing :: proc(p: AddProc) {
p(1, 2);
}
add :: proc(a, b: int) -> int {
return a + b;
}
main :: proc() {
x : int = 2;
x = x * 3;
y := add(1, x);
// do_thing(add(1, x));
do_thing(proc(a, b: int) -> f32 {
return a*b - a%b;
});
}