Bifalgorithm post · Computer science one · Computing a Logarithm
What curly-bracket convention should be used with conditional statements?
What curly-bracket convention should be used with conditional statements? (Computer science one · Computing a Logarithm) — "Another convention that we’ve used…
Ideas in this flowchart
- Convention for placing curly brackets in code
- Curly brackets are not necessary when a conditional statement contains only one statement.
- It is best practice to include curly brackets even when they are optional.
- The opening curly bracket is placed on the same line as the conditional statement.
- The closing curly bracket is indented to the same level as the start of the conditional statement.
- Code inside the code block is indented.
- Multiple statements in the block are placed at the same indentation level.