Hi,

Here is a method inside a string returning function:

My Question:Code:string computeSin(argument 1, argument 2) { if ( strcmp(icmop->icmo_addl_infop->retval_str, "USA") == 0 ) { string newIsin = (string)"US" + icmop->icmo_tranche_cusips[trancheNum]; int d1, d2, sum, multiply, i; for (sum = 0, multiply = 1, i = 10; i > -1; --i) { switch (i) { case 0: case 1: if (isupper(newIsin[i])) d1 = newIsin[i] - 'A' + 10; else return 0; break; default: if (isupper(newIsin[i])) d1 = newIsin[i] - 'A' + 10; else if (isdigit(newIsin[i])) d1 = newIsin[i] - '0'; else return 0; break; } if (d1 < 10) { d1 *= (multiply ? 2 : 1); multiply = !multiply; } else { d2 = d1 / 10; d1 %= 10; d1 *= (multiply ? 2 : 1); d2 *= (multiply ? 1 : 2); sum += (d2 % 10) + (d2 / 10); } sum += (d1 % 10) + (d1 / 10); } sum %= 10; sum = 10 - sum; sum %= 10; std::stringstream isinSs; isinSs << newIsin << sum; const std::string &checkedIsin = isinSs.str(); return checkedIsin; } return argument 2; }//end of string method

If in the switch statement section of this code I reach return 0 (appears twice: once in case 1 and other in default), would I be taken out of this computeSin method or would I keep looping till the for loop finishes?

Normally, a return statement takes you out of a function but in this case if I reach return 0 which is in a switch statement that will keep running till the for loop ends, would I exit the whole method?

Thanks.