2 Making Blocks with INPUTS
1 2 3 Today’s Objectives Know how to break problems down into chunks Know how to define blocks with inputs 3 Know how to call the blocks in a program Create programs where you create your own blocks with inputs
Homework Subject Homework Date Done Computing Learn “2. Making Modular Programs” for test
‘Smarter’ programming Smart programmers break problems down into smaller parts so they can write code in chunks or modules. In Scratch, you create modules by making your own blocks. Scratch Blocks Own Blocks
dd/mm Leave page blank
2. Making Modular Programs dd/mm Leave page blank
2. Making Modular Programs dd/mm
2. Making Modular Programs dd/mm Smart programmers break problems down into smaller parts so they can write code in chunks or modules.
2. Making Modular Programs dd/mm Smart programmers break problems down into smaller parts so they can write code in chunks or modules. Modules of code are good because: You can give them names You can give them different inputs to vary the results And chunks make a program easier to understand and debug
Scratch blocks can take INPUTS number e.g. 1, 20, -2, 3.4 number e.g. 90, 15, -180 text e.g. “Hi”, “meow”, “Correct”
3 Stages of creating blocks BLOCK NAME 3 Stages of creating blocks You define a block with a meaningful name You add any inputs like special variables to use in the block You call the new block from your program INPUT Use INPUT like a block variable length
2. Making Modular Programs dd/mm Smart programmers break problems down into smaller parts so they can write code in chunks or modules. Modules of code are good because: You can give them names You can give them different inputs to vary the results And chunks make a program easier to understand and debug In Scratch, you create modules by making your own blocks in 3 stages: You define a block with a meaningful name You add any inputs like special variables to use in the block You call the new block from your program
In Scratch, you create modules by making your own blocks in 3 stages: You define a block with a meaningful name You add any inputs like special variables to use in the block You call the new block from your program Here is an example of how you define & call a block that uses inputs:
Making a block with INPUTS number or text label label
Making Blocks input number or text input boolean label
draw square input steps number or text label label
Define block with inputs Inputs are like special block variables
Challenges Draw this pattern Draw any pattern
draw any shape input steps input sides text or number input text or number label label label
Define
Challenges Draw pattern using draw any shape block Draw any pattern
Challenges Draw this pattern Draw any pattern
1 2 3 Today’s Objectives Know how to break problems down into chunks Know how to define blocks with inputs 3 Know how to call the blocks in a program Create programs where you create your own blocks with inputs