Use curly braces effectively
Guidewire recommends the following best practices for effective use of curly braces:
- Surround every logical block,
even single-statement blocks, with curly braces (
{}). - Put the opening curly
braces (
{) on the same line that starts the block. - Put the closing curly
brace (
}) on the line after the last statement in the block, aligned with the starting column of the block.if(premium <= 1000) { // Put opening curly brace on line that starts the block. print("The premium is " + premium) // Surround even single-line blocks with curly braces. } // Put closing curly brace on line after last statement.
