My problem code is the one that determine the user input whether it is out of range or not. When I talk about the code later here, I refer to this one.
This one is my error message.
I tried to fix it by changing the order within the first “else”, but the error was still there so I move the codes lines to “else if” above the first “else”. Here is the picture of it. The program work as I expected.
Here is what I wondering:
The instruction told me to put that code under the first ‘else’ as shown in both pictures, but the first time I did that, the program gave me an error message so I fixed it as shown in the second picture. My question is “Will this come back to bite me later? Or this can be an alternate way of writing this code?” At this point I still can’t think of any future problem, but if there will be one that I should foreseen, I would like you to enlighten me. Especially if it would become a serious problem later. I don’t want to develop a bad habit without knowing it.