I don\'t get what does \"unreachable code\" means ?
Here in the last line of my code double probabilityOfWin = wins / (wins + loses);
it says unreachabl
This loop here:
while(GAMES <= 9999)
{
...
}
resolves to while (true)
because the value of GAMES
is never modified. So any code that comes after (in your case, double probabilityOfWin = wins / (wins + loses);
) is deemed unreachable.
You did not make any change to the constant GAME
. So while
loop will never terminate. Last line of code is unreachable.
Unreachable means the code never gets executed. For example,
return 15;
int a = 12;
Then the last line of code will not get executed because the function has already returned.