Skip to content

Files

Latest commit

 

History

History
25 lines (16 loc) · 438 Bytes

MandatoryBracesIfStatements.md

File metadata and controls

25 lines (16 loc) · 438 Bytes

Pattern: Missing braces for multi-line statement

Issue: -

Description

Adding braces would improve readability and avoid possible errors.

Example of incorrect code:

val i = 1
if (i > 0)
    println(i)

Example of correct code:

val x = if (condition) 5 else 4

Further Reading