diff options
| author | gingerBill <ginger.bill.22@gmail.com> | 2016-07-22 16:09:49 +0100 |
|---|---|---|
| committer | gingerBill <ginger.bill.22@gmail.com> | 2016-07-22 16:09:49 +0100 |
| commit | f8fd6fce0b9aabd9562ac8d0dda712154b829f26 (patch) | |
| tree | 458af62a56423f4096834c5151fb1990fe2a721c /examples | |
| parent | 86c083535f5f198c00901f3b137cf52ac36691fe (diff) | |
Procedure Literal
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/other.odin | 5 | ||||
| -rw-r--r-- | examples/test.odin | 20 |
2 files changed, 18 insertions, 7 deletions
diff --git a/examples/other.odin b/examples/other.odin index 380e96bd7..e69de29bb 100644 --- a/examples/other.odin +++ b/examples/other.odin @@ -1,5 +0,0 @@ -import "test" - -add :: proc(a, b: int) -> int { - return a + b; -} diff --git a/examples/test.odin b/examples/test.odin index c4c966d69..2dd012681 100644 --- a/examples/test.odin +++ b/examples/test.odin @@ -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; + }); + } |