Yes or No Options

Alex via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 27 09:47:58 PDT 2015


Okay. By pure trying I found out what I did wrong:

Apparently by typing Y I entered the shift key. Could that have 
been the problem?
I changed it to a small y and it at least jumped back to the 
commandline instead of just being stuck.

And by changing:

writeln("Do you want to play again? Y/N?");
	readln(yesno);
	if (yesno == "y") {
		writeln("Yeah!");
	}

to:

writeln("Do you want to play again? Y/N?");
	readln(yesno);
	if (yesno != "y") {
		writeln("Yeah!");
	}

So instead of ==   I used  !=

Now it works. But I still do not know why..




More information about the Digitalmars-d-learn mailing list