fork download
  1. import std.stdio;
  2.  
  3. void death()
  4. {
  5. writeln("death");
  6. scope(success) { writeln("success!"); }
  7. scope(failure) { writeln("failure!"); }
  8. }
  9.  
  10. void main()
  11. {
  12. try {
  13. scope(failure) { death(); }
  14. writeln("throwing...");
  15. throw new Exception("exception");
  16. } catch {}
  17. writeln("done");
  18. }
  19.  
Success #stdin #stdout 0.01s 2120KB
stdin
Standard input is empty
stdout
throwing...
death
success!
done