Administrator
|
What tool is telling you that the code is unreachable? The supplied Jack compiler? I wouldn't think that it was that sophisticated.
The reason, however, is that the Jack language specification requires that local variables be initialized to zero. That means that 'key' will start out as zero, which means that the first while loop WILL run, and that loop's body ends with a return statement.
As for the second question, you haven't shown the entire while() loop body. I'm assuming that there's a statement somewhere in it that has the ability to change the value of 'exit'.
|