Functions
Stop repeating yourself. Learn to define reusable blocks of code, pass data in, get results back, and organize your programs into logical pieces.
Lessons
1. Intro
Why functions matter
2. What is a Function?
The core concept
3. Function Syntax
How to write one
4. Calling Functions
Running the code
5. Void Functions
Functions that just do work
6. Quiz: Function Basics
Function types
7. Return Statements
How functions give results
8. Quiz: Code organization
Code organization
9. Parameters vs Arguments
Input terminology
10. Pass by Value
How data flows in
11. Quiz: Function inputs
Function inputs
12. Challenge: Square Function
Write your first function
13. Multiple Parameters
More than one value
14. Default Parameters
Setting fallback values
15. Quiz: Function inputs
Function inputs
16. Function Declarations vs Definitions
Signatures vs implementations
17. Header Files Basics
Reusing across files
18. Challenge: Is Positive
Boolean return type
19. Scope
Where variables live
20. Quiz: Understanding #include
Understanding #include
21. Variable Lifetime
Creation and destruction
22. Function Overloading
Multiple versions
23. Recursion Basics
Functions calling themselves
24. Quiz: Code organization
Code organization
25. Helper Functions
Small reusable pieces
26. Problem: Temperature Converter
Celsius to Fahrenheit
27. Problem: Is Even or Odd
Checking number parity
28. Quiz: Function Design
Test your understanding
29. Problem: Find Maximum
Returning the larger value
30. Problem: Calculate Average
Multiple parameters
31. Problem: Print Rectangle
Using void functions
32. Problem: Validate Range
Checking bounds
33. Problem: Count Digits
Recursion or loops
34. Problem: Is Prime
Checking divisibility
35. Quiz: Function Parameters
Test your understanding
36. Problem: Swap Two Numbers
Pass by value limits
37. Problem: Factorial
Iterative or recursive
38. Problem - Domino piling
Fitting dominoes on a board
39. Domino piling - The Idea
Think about total space
40. Domino piling - Algorithm
Breaking down the solution
41. Quiz: Post-check loop
Post-check loop
42. Domino piling - Implementation
Complete solution
43. Lessons from Domino piling
summary
44. Problem - Young Physicist
Checking force balance
45. Young Physicist - The Idea
Add each dimension separately
46. Young Physicist - Algorithm
Breaking down the solution
47. Quiz: Code organization
Code organization
48. Young Physicist - Implementation
Complete solution
49. Lessons from Young Physicist
summary
50. Section Recap
What we learned