__stdin.d(2): Error: found End of File when expecting }

Andre Pany andre at s-e-a-p.de
Wed Jul 17 20:29:50 UTC 2019


On Wednesday, 17 July 2019 at 20:02:51 UTC, ag0aep6g wrote:
> On 17.07.19 21:05, Andre Pany wrote:
>
>> [...]
>
> Check out what `echo $text` prints:
>
> ----
> import std; void main() { while(true) { string enemy1 = 
> readln().strip; int dist1 = to!int(readln().strip); string 
> enemy2 = readln().strip; int dist2 = to!int(readln().strip); // 
> Write an action using writeln() writeln(dist1 > dist2 ? enemy2 
> : enemy1); // Enter the code here } }
> ----
>
> Note that it's all on one line. And remember that a "//"-style 
> comment spans the rest of the line.
>
> That's right. Everything after the first "//" is now part of 
> the comment, all the way to the last closing brace. Obviously, 
> that's not valid code anymore.
>
> Try using double quotes around $text:
>
>     echo "$text" | dmd -

Thanks a lot, that solved the issue.

Kind regards
Andre


More information about the Digitalmars-d-learn mailing list