The example in the documentation fails to compile. We get the message... "voids have no value" // TEST 1 import std.stdio; void dotimes(int count, void delegate() exp) { for (int i = 0; i < count; i++) exp(); } void foo1() { int x = 0; dotimes(10, writef(x++)); } bool scase(bool b, void delegate() dg) { if (b) { dg(); return true; } return false; } void cond(bool delegate()[] cases ...) { foreach (c; cases) { if (c()) break; } } void foo2() { int v = 2; cond ( scase(v == 1, writefln("it is 1")), scase(v == 2, writefln("it is 2")), scase(v == 3, writefln("it is 3")), scase(true, writefln("it is the default")) ); } void main() { foo1(); foo2(); } // ------- code ends ---- I had to change "writef(...)" to "{writef();}" to get it to compile.
Fixed 0.166
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル