Functions

Stop repeating yourself. Learn to define reusable blocks of code, pass data in, get results back, and organize your programs into logical pieces.

50 lessons
203 min

Lessons

1. Intro

Why functions matter

4m

2. What is a Function?

The core concept

4m

3. Function Syntax

How to write one

4m

4. Calling Functions

Running the code

4m

5. Void Functions

Functions that just do work

4m

6. Quiz: Function Basics

Function types

2m1 problems

7. Return Statements

How functions give results

4m

8. Quiz: Code organization

Code organization

3m1 problems

9. Parameters vs Arguments

Input terminology

4m

10. Pass by Value

How data flows in

4m

11. Quiz: Function inputs

Function inputs

3m1 problems

12. Challenge: Square Function

Write your first function

7m1 problems

13. Multiple Parameters

More than one value

4m

14. Default Parameters

Setting fallback values

4m

15. Quiz: Function inputs

Function inputs

3m1 problems

16. Function Declarations vs Definitions

Signatures vs implementations

4m

17. Header Files Basics

Reusing across files

4m

18. Challenge: Is Positive

Boolean return type

7m1 problems

19. Scope

Where variables live

4m

20. Quiz: Understanding #include

Understanding #include

3m1 problems

21. Variable Lifetime

Creation and destruction

4m

22. Function Overloading

Multiple versions

4m

23. Recursion Basics

Functions calling themselves

4m

24. Quiz: Code organization

Code organization

3m1 problems

25. Helper Functions

Small reusable pieces

4m

26. Problem: Temperature Converter

Celsius to Fahrenheit

4m1 problems

27. Problem: Is Even or Odd

Checking number parity

4m1 problems

28. Quiz: Function Design

Test your understanding

3m1 problems

29. Problem: Find Maximum

Returning the larger value

4m1 problems

30. Problem: Calculate Average

Multiple parameters

4m1 problems

31. Problem: Print Rectangle

Using void functions

4m1 problems

32. Problem: Validate Range

Checking bounds

4m1 problems

33. Problem: Count Digits

Recursion or loops

4m1 problems

34. Problem: Is Prime

Checking divisibility

4m1 problems

35. Quiz: Function Parameters

Test your understanding

3m1 problems

36. Problem: Swap Two Numbers

Pass by value limits

4m1 problems

37. Problem: Factorial

Iterative or recursive

4m1 problems

38. Problem - Domino piling

Fitting dominoes on a board

4m1 problems

39. Domino piling - The Idea

Think about total space

4m

40. Domino piling - Algorithm

Breaking down the solution

4m

41. Quiz: Post-check loop

Post-check loop

3m1 problems

42. Domino piling - Implementation

Complete solution

7m1 problems

43. Lessons from Domino piling

summary

4m

44. Problem - Young Physicist

Checking force balance

4m1 problems

45. Young Physicist - The Idea

Add each dimension separately

5m

46. Young Physicist - Algorithm

Breaking down the solution

4m

47. Quiz: Code organization

Code organization

3m1 problems

48. Young Physicist - Implementation

Complete solution

7m1 problems

49. Lessons from Young Physicist

summary

4m

50. Section Recap

What we learned

5m

Ready to start learning?

Access all 50 lessons with interactive content and progress tracking.