TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - Java Coding Standard
Search

Rule:  Basic34Checked automatically with code checker

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
  }
}