EBWB - Enclosing Body Within a Block
The statement of a loop must always be a block. The
then and else
parts of if
-statements must always be blocks.
This makes it easier to add statements without accidentally introducing bugs
due to forgetting to add braces.
Wrong
return;
while(
st.countTokens() > 2 )
s += st.nextToken();
Tip: Always enclose body within a block
Right
return;
}
while(
st.countTokens() > 2 ) {
s +=
st.nextToken();
}