So, I can use "while" and "if" statements. But I would like to know if there is such a thing as a "when" statement. So, if you choose to reply to this inquiry of mine, please apprise me as to whether "when" statements are real and if they are, show me an example in a source code. I don't want this to be to complicated. Just an example of a couple lines that would precede the statement, the statement its self, and a couple lines that would follow the statement). And if you like, would you just give me some statements that might be useful in the future?
If I might add to what amaac said: In the case you are thinking of something like
1 2 3 4 5 6 7 8 9 10
//doing stuff
when (exit == 1)
{
//do the exit stuff
}
//other stuff
//something that makes exit == 1; statements inside the when bracket execute
You would need to do a little more work to create that scenario. The simpliest way is to test for exit == 1 after every time it might change, then execute a function if it did. This will work for most small programs, for larger programs there are multiple ways to handle this, such as registering it as an event or having a command queue.