Legacy flow control with more than one statement

CachéQuality release 
1.0.0
Id 
OS0068
Rule type 
Severity 

Major

Major
SQALE characteristic 
  • Maintainability
    • Readability
Tags 
coding-guidelines, confusing
Remediation function 
Constant/issue
Remediation cost 
5min

It is possible for legacy flow control statements (if, else and for) to have more than one statement; for instance:

    // if condition c is true, set variable x then print variable y
    if c set x = 1 w y,!

However, this is hardly readable.

If you have more than one statement, it is preferred to use the brace forms of these statements instead; the code above becomes:

    if c {
        set x = 1
        w y, !
    }

More generally, in new code, you should prefer using the brace forms of flow control statements instead of the legacy, braceless forms.