Look at my example:
----
import std.stdio;
import std.string;
import std.conv : to;

void main()
{
    while (true) {
        write("Roll the dice: Enter a number: ");
        int dieNumber = readln.strip.to!int;

        if (dieNumber < 4) {
            writeln("You won!");
        }
        else if ((dieNumber >= 4) && (dieNumber <= 6)) {
            writeln("I won!");
        }
        else if (dieNumber > 6){
            writeln("ERROR: Invalid Value");
        }

        writeln("Do you want to play again? Y/N?");
        immutable string yesno = readln.strip;

        if (yesno.toLower() != "y")
            break;

        writeln("Let's go again!");
    }
}
----

With the while loop you really can "go again" ;)

Reply via email to