Problem with using readln.

JV via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 29 19:07:48 PDT 2017


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(func);

     if(func == 1)
     {
         writeln("hello world");
     }
     if(func == 2)
     {
         writeln("hello world");
     }
     if(func == 3)
     {
         writeln("endtime");
     }
     if(func == 4)
     {
         writeln("hello world");
     }
     if(func == 5)
     {
         writeln("hello world");
     }


More information about the Digitalmars-d-learn mailing list