ACR Rules

⌘K
  1. Home
  2. Docs
  3. ACR Rules
  4. Reliability (41)
  5. Expressions for “then” and “else” in an “if” statement should be different

Expressions for “then” and “else” in an “if” statement should be different

Having identical expressions for both then and else branches in an if statement is an error. Either a copy-paste error was made and something different should be executed, or there shouldn’t be an if at all.

Noncompliant example:

if $Variable < 5
then Module.Enumeration.Small
else Module.Enumeration.Small

Compliant example:

if $Variable < 5
then Module.Enumeration.Small
else Module.Enumeration.Medium