+ 3
What is the meaning of error "unreachable statement "?
7 ответов
+ 3
Sarvesh Chaudhary
Some suggestions:
Look at the code preceding the unreachable statement:
- maybe it is within a if or while loop where the condition is always false?
- maybe it is within a if or while loop but after a break or continue?
- maybe it is after an infinite loop?
Look at the variables: if their value never changes but they are used for if, while or switch blocks, you may have unreachable statements.
Also look at the return, break and exit statements:
The code after those statement is unreachable
+ 3
Unreachable statement means there is a line of code that will never be executed.
For example, some code after a "return" in a function.
+ 2
Sarvesh Chaudhary
can you share a code with us
so that we can help you..
+ 1
thanks
but I have not defined my own function
I have written all program in main method
+ 1
could also be in an if or have something to do with the placement of the break or continue statement
+ 1
I can but its too long
+ 1
Thank you very much. ifl
☺