- Grades 3 - 5
- Beginner level
- 10 lessons
- Tynker Blocks
- Web iPad
- 10 lessons
- 67 activities
- Enhanced Creativity Tools
- Automatic Assessment
- Tutorials and Reviews
- Coding Puzzles
- DIY Projects
- Answer Keys
No previous coding experience required.
Course: Dragon Spells
Lesson 6: Ancient Spells
Number of Levels: 6
Time: 30+ mins
IntroductionIn this lesson, students are introduced to functions. A function is a group of code commands that can be run together as if it were a single command. To use the set of commands in a function, students will need to use the name of the function to execute it. Functions are useful when you want to perform the same actions many times but you do not want to have a lot of repeated code blocks. Similar to loops, functions make your code more efficient. The function will be defined in a “function definition” block. To use the function, students will need to use the “function command” code block. These blocks will be given to your students so they will not have to name the functions themselves.
New Code Blocks
: The “climb up” command code block will run all of the blocks attached to the “climb up” function definition code block. : The “remove barrier” command code block will run all of the blocks attached to the “remove barrier” function definition code block. : The “remove and climb” command code block will run all of the blocks attached to the “remove and climb” function definition code block.
- Function: A sequence of commands that can be run together as if it were a single command
- Use function code blocks
- Apply knowledge of sequencing and loops to solve puzzles
- iPads (with installed Tynker app), computers, or laptops
Warm-Up (5 minutes)Explain to students that a function is a group of code commands that can be run together as if it were a single command. Next, ask them to pair up and think of an everyday task that requires the same instructions to be repeated, such as chewing food. Can they list and order the steps for eating their favorite food? Encourage students to write pseudocode for a "chewing food" function.
Activities (30 minutes)Facilitate as students complete all Ancient Spells modules:
- Inform students that this lesson has 6 levels that they need to complete.
- Direct your students attention to the "remove barrier" function definition code block in level 1. In levels 1-2, the "remove barrier" function definition block has code attached to it that will make the dragon perform the following sequence: eat - walk - blast - walk. Emphasize to students that in order to call this function, they will need to attach the "remove barrier" function command code block to the "on start" code block.
- To solve level 3, students need to use a "repeat" code block and use the "climb up" function command code block.
- In level 4, point out to students that the "climb up" function definition block uses the same code blocks as the previous level. However, the code blocks are arranged in a different sequence.
- Level 5 uses the "remove and climb" function definition block, which will make the dragon perform the following sequence when called: eat - walk - blast - walk - turn around - jump. Give a hint: Tell students to use two "walk" commands after the "repeat" block.
- In level 6, the "remove and climb" function definition block will make the dragon perform the following sequence when called: walk - walk - eat - walk - blast - walk - turn around - jump.
Extended Activities (10 minutes)Discussion
Ask your students…
- What's a function? (Answer: A sequence of commands that can be run together as if it were a single command)
- What's the difference between a "function definition" block and a "function call" block (Answer: The "function definition" block describes what the function will do, whereas the "function call" block can be used to call a function again and again)
- What are some benefits of using functions? (Example: Functions can break down complex tasks into a composition of simpler ones)
- CCSS-Math: K.CC.B.5, 2.OA.B.2, MP.1
- CCSS-ELA: RF.K.4, RF.1.4, RF.2.4, RF.1.4.A, RF.2.4.A, 1.RI.10, 2.RI.10
- CSTA: 1A-AP-09, 1A-AP-11, 1B-AP-11, 1B-AP-15
- CS CA: K-2.AP.13, 3-5.AP.10, 3-5.AP.13, 3-5.AP.17
- ISTE: 1.c, 1.d, 4.d, 5.c, 5.d, 6.b
U.K. StandardsKey Stage 1
- Use logical reasoning to predict the behaviour of simple programs
- Use technology safely and respectfully, keeping personal information private; identify where to go for help and support when they have concerns about content or contact on the internet or other online technologies
- Design, write and debug programs that accomplish specific goals, including controlling or simulating physical systems; solve problems by decomposing them into smaller parts.
- Use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs.
- Understand computer networks, including the internet; how they can provide multiple services, such as the World Wide Web, and the opportunities they offer for communication and collaboration.
- Use technology safely, respectfully and responsibly; recognise acceptable/unacceptable behaviour; identify a range of ways to report concerns about content and contact.