learning D. Experienced issue very quickly.

Steven Schveighoffer schveiguy at yahoo.com
Wed Apr 18 06:19:43 PDT 2012


On Wed, 18 Apr 2012 09:10:46 -0400, Mark <section91 at yahoo.com> wrote:

> Yeah I bought the book recently and ran into an issue very quickly into  
> it. But this error I keep getting keeps bugging me. Could really use an  
> explanation on why its not compiling. Here is the code.
>
> /*
>    Compute heights in centimeters for a range of heights
>    expressed in feet and inches
> */
> import std.stdio;
>
> void main() {
>    // values unlikely to change soon
>    immutable inchPerFoot = 12;
>    immutable cmPerInch = 2.54;
>
>    // loop'n write
>    foreach (feet; 5 .. 7) {
>      foreach (inches; 0 .. inchPerFoot) {
>        writeln(feet, "'", inches, "''\t",
>          (feet * inchPerFoot + inches) * cmPerInch);
>      }
>    }
> }
>
>
> Here is the error I keep getting every time I try to compile:
>
> (13): found '..' when expecting ')'
> (13): found ')' when expecting ';' following statement
> (14): found '..' when expecting ')'
> (14): found ')' when expecting ';' following statement

This compiles and runs on my system.

Are you using D1?  Please use the latest D (a.k.a D2) compiler.  The book  
does *not* cover D1 at all.

If you are, please give more detail (OS, which compiler you are using).

-Steve


More information about the Digitalmars-d-learn mailing list