mirror of
https://github.com/odin-lang/Odin.git
synced 2026-03-08 09:35:36 +00:00
Add deferred procedure associations to demo.odin
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user