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

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");
    }

I added the () at readln() got deleted when editing the code before i posted. sorry

On Sunday, 30 April 2017 at 03:13:14 UTC, JV wrote:
    int func;
    writeln("\t\tEnter Selection : ");
    func = readln;
    readln(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");
    }
    else
    {
    display();
    }

Mybad i posted the wrong one

Reply via email to