Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,7 @@
|
|||
import std.stdio;
|
||||
|
||||
void main() {
|
||||
label1:
|
||||
writeln("I'm in your infinite loop.");
|
||||
goto label1;
|
||||
}
|
||||
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).");
|
||||
}
|
||||
}
|
||||
13
Task/Flow-control-structures/D/flow-control-structures-3.d
Normal file
13
Task/Flow-control-structures/D/flow-control-structures-3.d
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import std.stdio;
|
||||
|
||||
void main(string[] args) {
|
||||
scope(exit)
|
||||
writeln("Gone");
|
||||
|
||||
if (args[1] == "throw")
|
||||
throw new Exception("message");
|
||||
|
||||
scope(exit)
|
||||
writeln("Gone, but we passed the first" ~
|
||||
" chance to throw an exception.");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue