```do { // some code here TODO() } while (...
# intellij
p
Copy code
do {
    // some code here
    TODO()
} while (true) // warning for unreachable code with suggestion to replace with 'while()'. It is unreachable but in this case i think it should be ok
p
the
true
expression is unreachable though - TODO will always throw and so the flow will never reach the point of checking the result of the
true
expression to decide whether to loop again.
p
I understand that. The point is there is no way to change it other then suppress warning.
m
The question is: why using a "do-while" loop in such a case? Isn't a simple while-loop enough, like:
Copy code
while (true) {
        // some code here
        TODO()
    }