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