CS 301 - Conditionals

Review: Indentation (and Definition vs. Invocation)

Review: Argument Passing

Absolute

The following four functions accomplish the same thing. Which style do you like best? This is a matter of personal preference.

Solution 1: Pure Math

Solution 2: Return After Conditional

Solution 3: Return on Each Branch

Solution 4: Implied Else (if the first return doesn't execute, we must be handling the False case)

Worksheet Problem 1

Worksheet Problem 2

Worksheet Problem 3