Robot class question

When I get a color input for my robot if the input is wrong ( I mean if it's not a proper color ) my program should end but instead, the program continues by assigning the default color, yellow, to my robot.

How can I make my robot program end when the color input is wrong? Thanks.
Looks like something like:

if (color != proper_color) {   // this should be well thought
        // ... provoke end of program, error, and output to let the user know what happened

should do it. Your question is a bit ambiguous. You need more precise help?
and suddenly I understood why these aren't work
Last edited on
Topic archived. No new replies allowed.