Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

If-Else Conditionals

Guidelines

1) Want the expected case to be the first if block

  • Include an else clause too
    • 50-80% of if statements should have one
  • Account for both cases in testing

2) Simplify complicated tests with boolean function calls

Misc

  • Main goal is to reduce complexity
  • Phrase things positively
    • "I ain't not no undummy" - Homer Simpson
  • Break complicated tests into partial tests
  • Use literal True and False values instead of 1, 0
  • Control flow complexity is correlated with
    • Low reliability
    • Frequent errors