aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-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();
}
}