mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Add deferred procedure associations to demo.odin
This commit is contained in:
@@ -868,6 +868,22 @@ diverging_procedures :: proc() {
|
|||||||
foo();
|
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() {
|
main :: proc() {
|
||||||
when true {
|
when true {
|
||||||
general_stuff();
|
general_stuff();
|
||||||
@@ -883,5 +899,6 @@ main :: proc() {
|
|||||||
deprecated_attribute();
|
deprecated_attribute();
|
||||||
bit_set_type();
|
bit_set_type();
|
||||||
diverging_procedures();
|
diverging_procedures();
|
||||||
|
deferred_procedure_associations();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user