Page 462 of book: Programming in D

This won't compile.  Is this obsolete?
```
app.d(8,8): Error: identifier expected inside `debug(...)`, not `1`
    debug(1) writeln("entered myFunction");
          ^
source\app.d(10,8): Error: identifier expected inside `debug(...)`, not `2`
    debug(2) {
          ^
Error C:\D\dmd2\windows\bin64\dmd.exe failed with exit code 1.
```

source/app.d
```
debug import std.stdio;

void main() {
        myFunction("deneme.txt", [10, 4, 100]);
}

void myFunction(string fileName, int[] values) {
        debug(1) writeln("entered myFunction");

        debug(2) {
                writeln("the arguments:");
                writeln("  file name: ", fileName);
                
                foreach (i, value; values) {
                        writefln("  %4s: %s", i, value);
                }
        }

        // ... the implementation of the function ...
}

```
  • dmd debug(level)... Brother Bill via Digitalmars-d-learn

Reply via email to