Last Round: Make More
Click this button to make your block (a function).
A function in programming is a set of instructions that tells the computer how to do a specific task. Think of it like a recipe you can follow whenever you need to make something. Instead of writing the same steps over and over, you can just call the function when you need it. This makes your code shorter and easier to read by avoiding copy-paste work. Functions can also take inputs (like ingredients) and give you a different result (like different flavors of ice cream).
Decide name, input, and label in your function.
Block Name Area:
This is where you give your custom block a name. This name will appear on the block itself and in the block palette. You would typically name it based on the function it performs.
Options for Inputs:
Add an input (number or text): This allows you to add an input field to your block where you can enter numbers or text. This is useful for creating blocks that can take different parameters.
Add an input <boolean>: This allows you to add a boolean input, which is a True/False or Yes/No option, represented by a hexagonal shape.
Add a label: This lets you add non-editable text to your block to make it more readable and to describe what the inputs are for.
Run without screen refresh checkbox:
If this is checked, the custom block will run without forcing the screen to update until the block finishes running. This can make scripts that use the block run faster because Scratch is not updating the stage with every change. However, it also means that you won't see what the script is doing until it's done.
Call(use) your function
Block name: Find the right customized block you want to use by the name. It is case-sensitive and should match exactly the name you made.
<Boolean>:
If this block can take a boolean input, this hexagonal slot accepts a value that is only True or False. This could be used for conditions or toggles within the block's functionality.
(Number or Text):
This oval slot accepts either a number or text input. This could be used to pass specific data into the block, like a number for calculations or a string for text manipulation.
When you use this block in a Scratch project, you would plug appropriate boolean and number or text blocks into these slots to pass values into the custom block when it runs. The behavior of the custom block would depend on the scripts you attach to it in the block definition area. Custom blocks like this are great for creating reusable code and simplifying complex scripts by abstracting them into single blocks with descriptive names and adjustable parameters(the official name for input blanks).