10. Functions Are at Your Beck and CallΒΆ

  1. 10.1. Introduction
    1. 10.1.1. Check Your Understanding
  2. 10.2. Using Functions
  3. 10.3. Creating Functions
    1. 10.3.1. Function Syntax
      1. 10.3.1.1. An Example
    2. 10.3.2. Defining and Calling
  4. 10.4. Function Input and Output
    1. 10.4.1. Return Statements
      1. 10.4.1.1. Returning a Value
      2. 10.4.1.2. Using return is Optional
      3. 10.4.1.3. return Terminates Function Execution
      4. 10.4.1.4. Boolean Functions
    2. 10.4.2. Parameters and Arguments
    3. 10.4.3. Arguments Are Optional
    4. 10.4.4. Check Your Understanding
  5. 10.5. A Good Function-Writing Process
    1. 10.5.1. Step 1: Design Your Function
    2. 10.5.2. Step 2: Create the Basic Structure
    3. 10.5.3. Step 3: Write the Body
  6. 10.6. Parameters and Variables
    1. 10.6.1. Function Scope
    2. 10.6.2. Variable Shadowing
    3. 10.6.3. Check Your Understanding
  7. 10.7. Naming Functions
    1. 10.7.1. Use Camel Case
    2. 10.7.2. Use Verb/Noun Pairs When Applicable
    3. 10.7.3. Use Descriptive Names
    4. 10.7.4. Check Your Understanding
  8. 10.8. Composing Functions
    1. 10.8.1. Palindrome Checker
      1. 10.8.1.1. The reverse Function
      2. 10.8.1.2. The isPalindrome Function
    2. 10.8.2. Functions Should Do Exactly One Thing
  9. 10.9. Why Create Functions?
    1. 10.9.1. Functions Reduce Repetition
    2. 10.9.2. Functions Make Your Code More Readable
    3. 10.9.3. Functions Reduce Complexity
    4. 10.9.4. Functions Enable Code Sharing
    5. 10.9.5. Functions Save Millions of Lives Every Day
  10. 10.10. Exercises: Functions
    1. 10.10.1. Rectangles
    2. 10.10.2. Triangles
    3. 10.10.3. Diamonds
    4. 10.10.4. Bonus Mission
  11. 10.11. Studio: Functions
    1. 10.11.1. Before You Start
    2. 10.11.2. Reverse Characters
    3. 10.11.3. Reverse Digits
    4. 10.11.4. Complete Reversal
    5. 10.11.5. Bonus Missions