Consider the following code:
float validateEntry()
{
string entry;
float value;
getline(cin, entry);
value = atof(entry.data());
return ((isNumber(entry) && value >= 0) ? i
: (cout << "Enter valid amount: ", validateEntry())
}
Why is the last line (the comma-separated expression) allowed, and are there other expressions that can be used with return statements in C++?
I'm mostly confused at the use of the comma, and wondering where this expression syntax is defined (I had no idea it existed, nor would I have known where to find out). Can I fill that last expression with an indefinite amount of code; if so, what are the limitations, requirements, etc.?