https://issues.dlang.org/show_bug.cgi?id=20997
Issue ID: 20997 Summary: Missing example of scope guard executing after return statement Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dlang.org Assignee: nob...@puremagic.com Reporter: simen.kja...@gmail.com As pointed out on the forum[0], the documentation[1] for scope guards should include an example with a return statement. Something like this: import std.stdio; int fun() { scope (exit) writeln("Scope guard"); return gun(); } int gun() { writeln("Inside gun()"); return 3; } Will print: Inside gun() Scope guard [0]: https://forum.dlang.org/thread/qzhhdjqvjxsycuxjd...@forum.dlang.org [1]: https://dlang.org/spec/statement.html#scope-guard-statement --