Skip to main content

Defer

Use the defer keyword with a function call to execute the function call after the current function ends

src/structs.duck
fn f() {
defer std::io::println("this will get printed last");
std::io::println("this will get printed before defer");
}

fn main() {
f();
}