Re: Problem with using readln.

2017-04-30 Thread Ivan Kazmenko via Digitalmars-d-learn
On Sunday, 30 April 2017 at 02:07:48 UTC, JV wrote: Hello i'm kinda new to D language and i wanted to make a simple program but somehow my input does no go to my if statements and just continues to ask for the user to input.Kindly help me One way would be: import std.stdio; int x;

Re: Problem with using readln.

2017-04-29 Thread arturg via Digitalmars-d-learn
On Sunday, 30 April 2017 at 05:53:09 UTC, Andrew Edwards wrote: string line; parse!int((line = readln)).writeln; is there a reason you mix normal call and ufc or just some style? you can do this and remove some () (line = readln).parse!int.writeln;

Re: Problem with using readln.

2017-04-29 Thread Andrew Edwards via Digitalmars-d-learn
On Sunday, 30 April 2017 at 03:20:20 UTC, JV wrote: On Sunday, 30 April 2017 at 03:18:04 UTC, Adam D. Ruppe wrote: On Sunday, 30 April 2017 at 03:10:25 UTC, JV wrote: btw i forgot to add () at readln while editing the post That's not necessary, it doesn't change anything. But readln without

Re: Problem with using readln.

2017-04-29 Thread JV via Digitalmars-d-learn
On Sunday, 30 April 2017 at 03:18:39 UTC, JV wrote: On Sunday, 30 April 2017 at 03:13:14 UTC, JV wrote: On Sunday, 30 April 2017 at 02:07:48 UTC, JV wrote: int func; writeln("\t\tEnter Selection : "); readln(func);

Re: Problem with using readln.

2017-04-29 Thread JV via Digitalmars-d-learn
On Sunday, 30 April 2017 at 03:20:20 UTC, JV wrote: On Sunday, 30 April 2017 at 03:18:04 UTC, Adam D. Ruppe wrote: On Sunday, 30 April 2017 at 03:10:25 UTC, JV wrote: okay?? but how do i return an int? tried using what i found in the internet like using std.conv; to use toInt() but still sh

Re: Problem with using readln.

2017-04-29 Thread JV via Digitalmars-d-learn
On Sunday, 30 April 2017 at 03:18:04 UTC, Adam D. Ruppe wrote: On Sunday, 30 April 2017 at 03:10:25 UTC, JV wrote: btw i forgot to add () at readln while editing the post That's not necessary, it doesn't change anything. But readln without arguments returns a string, not an int. okay?? but

Re: Problem with using readln.

2017-04-29 Thread JV via Digitalmars-d-learn
On Sunday, 30 April 2017 at 03:13:14 UTC, JV wrote: On Sunday, 30 April 2017 at 02:07:48 UTC, JV wrote: Hello i'm kinda new to D language and i wanted to make a simple program but somehow my input does no go to my if statements and just continues to ask for the user to input.Kindly help me bt

Re: Problem with using readln.

2017-04-29 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 30 April 2017 at 03:10:25 UTC, JV wrote: btw i forgot to add () at readln while editing the post That's not necessary, it doesn't change anything. But readln without arguments returns a string, not an int.

Re: Problem with using readln.

2017-04-29 Thread JV via Digitalmars-d-learn
On Sunday, 30 April 2017 at 02:07:48 UTC, JV wrote: Hello i'm kinda new to D language and i wanted to make a simple program but somehow my input does no go to my if statements and just continues to ask for the user to input.Kindly help me btw here is my sample code int func; writeln("

Re: Problem with using readln.

2017-04-29 Thread JV via Digitalmars-d-learn
On Sunday, 30 April 2017 at 03:04:49 UTC, Adam D. Ruppe wrote: On Sunday, 30 April 2017 at 02:07:48 UTC, JV wrote: int func; writeln("\t\tEnter Selection : "); func = readln; writeln(func); That shouldn't even compile... are you sure that's your actual code, and that it is actuall

Re: Problem with using readln.

2017-04-29 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 30 April 2017 at 02:07:48 UTC, JV wrote: int func; writeln("\t\tEnter Selection : "); func = readln; writeln(func); That shouldn't even compile... are you sure that's your actual code, and that it is actually building successfully?

Problem with using readln.

2017-04-29 Thread JV via Digitalmars-d-learn
Hello i'm kinda new to D language and i wanted to make a simple program but somehow my input does no go to my if statements and just continues to ask for the user to input.Kindly help me btw here is my sample code int func; writeln("\t\tEnter Selection : "); func = readln; writeln(