aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-12-14 21:17:32 +0000
committergingerBill <bill@gingerbill.org>2018-12-14 21:17:32 +0000
commitd29335ececec993c8df336b6482a6b213bc13361 (patch)
tree6d240b28dbc9f031c49a1b3a99077efcb7a7186f
parent95873e66ab8cfe6fe7be3842e4a753961fd0bfb3 (diff)
Add deferred procedure associations to demo.odin
-rw-r--r--examples/demo/demo.odin17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/demo/demo.odin b/examples/demo/demo.odin
index 2d4303682..dcfb5a5bc 100644
--- a/examples/demo/demo.odin
+++ b/examples/demo/demo.odin
@@ -868,6 +868,22 @@ diverging_procedures :: proc() {
foo();
}
+deferred_procedure_associations :: proc() {
+ @(deferred=closure)
+ open :: proc(s: string) -> bool {
+ fmt.println(s);
+ return true;
+ }
+
+ closure :: proc(ok: bool) {
+ fmt.println("Goodbye?", ok);
+ }
+
+ if open("Welcome") {
+ fmt.println("Something in the middle, mate.");
+ }
+}
+
main :: proc() {
when true {
general_stuff();
@@ -883,5 +899,6 @@ main :: proc() {
deprecated_attribute();
bit_set_type();
diverging_procedures();
+ deferred_procedure_associations();
}
}