int main(int argc, char**argv)
{
if (argc<2)
goto invokeError;
for (int i=1; i<argc; i++){
bool found = false;
string parameter = "";
for (const auto& test: TestList){ //TestList is the structure Array.
if (test.name == argv[i]){
found = true;
if (i+1 < argc && argv[i+1][0] != '-'){ // get command argument
parameter = argv[i+1];
i++;
}
cout << "Running \"" << test.description << "\"" << endl;
if (!test.classPtr->run(parameter))
return 0;
break;
}
}
if (!found)
goto invokeError; // defined
}
return 0;
}
Can anyone explain the if condition and loop?