Got a practice question, and I have the below code:
while (false) { x=3; }
The x=3 is unreachable code, and I don't really understand why. There is a similar section of code:
if (false) { x=3; }
which is perfectly valid.
May be a bit of a noob question, or may be I'm just missing something, but if you could help me understand why that'd be great, thanks!
I am asking specifically about the difference between the if and while statement, because the same line of code changed to if, is valid and will compile.