Ric*_* Su 6 c++ if-statement return function break
我想要这样的事情发生:
void a(){
b()
// if condition met in b(), exit out of this function also
}
void b(){
if(condition){
super return
// also returns out of function a
}
}
Run Code Online (Sandbox Code Playgroud)
我似乎无法想办法做到这一点.任何帮助,将不胜感激.谢谢!
您可以通过以下任一方式进行操作
就像是
void a(){
if(b())
return;
}
bool b(){
if(condition){
// do something
return true;
}
}
Run Code Online (Sandbox Code Playgroud)