Hi everyone! I'm trying to do error handling (with the try block) and when I give a wrong value to the variable (it is an integer and I give a non-number value), then It doesn't let me re get input. The code:

int x;

bool not_accepted = false;

while (!not_accepted) {

    try {

        write("x: ");

        readf("%d\n", x);

        not_accepted = true;

} catch (Exception msg) {

        writeln("Please give a right coordinate");

    }

Reply via email to