On 06/26/2012 09:43 PM, Steven Schveighoffer wrote:
On Tue, 26 Jun 2012 10:40:18 -0400, Alexander
<alexan...@alexandermohn.com> wrote:
...
//Wait
void wait()
{
    writefln ("Type A to continue!");
    exittest();
}

//Exit tester
void exittest()
{
    char[] a;
    stdin.readln(a);
    if (a == "A")
    {
        exit();
    }
    else
    {
        wait();
    }
}

Hm... interesting code here :)

This is not horrible, just... weird.


It is functional style. ;)

You probably want to avoid recursion in this case:

void wait()
{
    char[] a;
    while(a != "A")
    {
        writeln("Type A to continue!");
        stdin.readln(a);
    }
}

-Steve

I want the two examples to generate comparable code.

Reply via email to