Synopsis: | Don't use unclear do/while loops |
Language: | Java |
Severity Level: | 7 |
Category: | Basic |
Description: |
Some do while loops are hard to understand and can be simplified or omitted.public class Example { { while (true) { } // allowed while (false) { } // should be removed; the block will never be executed do { } while (true); // should be simplified to while (true) { } do { } while (false); // should be simplified; the block will be executed once } } |