Hi Tzach,
I'm talking about a command to immediately exit the event. Sometimes when an event has a lot of commands it would be convenient to be able to exit it after some condition.
You know, like the "return" can be used to quickly exit the function in C. This way the code can become clearer with fewer if-else structures and less indentations.
For example, try to write the following without using quick exits. It soon becomes complex (and repetitive!) structure quite hard to grasp.
void foo() {
if( condition_1 ) {
do_something_1 ;
if( condition_2 ) {
do_something_2 ;
return ;
}
}
if( condition_3 ) {
do_something_3 ;
if( condition_4 ) {
do_something_4 ;
return ;
}
}
do_something_5 ;
}
Ok, it can be rewritten relatively straight forward with an additional variable and couple of more ifs. I do it that way at the moment, but it is slightly slower and not so elegant.