Skip to content

Files

Latest commit

 

History

History
30 lines (21 loc) · 517 Bytes

Style-IfUnlessModifierOfIfUnless.md

File metadata and controls

30 lines (21 loc) · 517 Bytes

Pattern: Use of if/unless in conditional

Issue: -

Description

Checks for if and unless statements used as modifiers of other if or unless statements.

Examples

# bad
tired? ? 'stop' : 'go faster' if running?

# bad
if tired?
  "please stop"
else
  "keep going"
end if running?

# good
if running?
  tired? ? 'stop' : 'go faster'
end

Further Reading