learning D. Experienced issue very quickly.
simendsjo
simendsjo at gmail.com
Wed Apr 18 06:20:17 PDT 2012
On Wed, 18 Apr 2012 15:10:46 +0200, 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
Are you using the D1 compiler..? It works on dmd 2.057,8 and 9 at least.
Just write dmd, and look at the top for the compiler version.
More information about the Digitalmars-d-learn
mailing list