Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
22
Task/Flow-control-structures/D/flow-control-structures-2.d
Normal file
22
Task/Flow-control-structures/D/flow-control-structures-2.d
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import std.stdio;
|
||||
|
||||
class DerivedException : Exception {
|
||||
this(string msg) { super(msg); }
|
||||
}
|
||||
|
||||
void main(string[] args) {
|
||||
try {
|
||||
if (args[1] == "throw")
|
||||
throw new Exception("message");
|
||||
} catch (DerivedException ex) {
|
||||
// We never threw a DerivedException, so this
|
||||
// block is never called.
|
||||
writefln("caught derived exception %s", ex);
|
||||
} catch (Exception ex) {
|
||||
writefln("caught exception: %s", ex);
|
||||
} catch (Throwable ex) {
|
||||
writefln("caught throwable: %s", ex);
|
||||
} finally {
|
||||
writeln("finished (exception or none).");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue