Use of postconditionals

objectscriptQuality release 
1.0.0
Id 
OS0039
Rule type 
Code Smell
Severity 

Minor

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

ObjectScript allows to attach postconditionals to some commands; for instance:

    // Set the value only if condition c is true
    set:c x = 2

This is in fact equivalent to writing:

    if (c) {
        set x = 2
    }

This feature of the language may lead to shorter code overall; however, users unfamiliar with the language may have trouble understanding what this syntax means.

For understandability reasons, it is preferred to use an if statement instead.