Functions
👩🏫 Teacher’s Guide
Objective
Students will explain functions as reusable groups of steps and identify how functions help organize code.
Teaching Notes
- Use a real-life example: a ‘make sandwich’ function with steps.
- Explain functions help reuse code without repeating it.
- Connect to block coding: custom blocks are like functions.
- Emphasize clear names: jump(), drawStar(), sayHello().
🧒 Student Worksheet
Concept and Helping Material
A function is a group of steps you can name and use again. Functions help organize code and make it easier to read. Instead of writing the same steps many times, you call the function.
Computer Vocabulary and Definition
- — A named group of steps you can use again.
- — To run a function.
- — To use something again.
- — Extra information you give a function.
- — To keep code neat and easy to understand.
Computer QA
1. What is a function?
2. What does call mean?
3. What does reuse mean?
4. What does organize mean?
5. What is a parameter?
6. True or False: Functions help avoid repeating code.
7. Why do programmers use functions?
8. What is an example function name?
9. If you call a function, what happens?
10. Can a function be used more than once?
11. True or False: A function must be used only one time.
12. What might a drawSquare function do?
13. What might a jump function do in a game?
14. Can functions make code easier to read?
15. What is one benefit of functions?
16. What is one place you see functions in block coding?
17. Can functions have inputs like a number?
18. What could a parameter change?
19. True or False: Functions help fix bugs faster.
20. What is one example of reusing a function?
Computer Prtactices
- Function plan: Write a function called cleanRoom with 4 steps.
- Call it: Write how to call drawStar 3 times in a row.
- Parameter idea: Make a function move(steps) and try steps = 5 and 10.
- Organize code: Group mixed instructions into two functions (jump and wave).
Reflection
- What is one reason to use functions?
- What function would you like to create?