(And you should start lowercasing your "a)
|Line 17:||Line 17:|
Revision as of 17:35, 18 September 2012
|This article or section contains information about a feature from a future version of Scratch that is unreleased and is subject to change. Please cite any additional info in order to prevent speculation.|
Procedures, also called functions or methods, are a tool in many programming languages, which allow common blocks of code to be grouped and called by a single name. Blocks in Scratch are procedures themselves, as they are blocks of compiled code executed all at once. Procedures have inputs or arguments, which are used to edit the procedure's effect slightly. For example, the "move (10) steps" block has the numerical argument (the bracketed bit) which specifies the distance to be moved: 10 pixels in this case.
Procedures in Scratch
Procedures will be added in Scratch 2.0. There will be a "More Blocks" palette, where procedures in the project are stored. This palette also houses a "make a block" button, similar to the "make a variable/list" buttons in Data Blocks. The procedures will be local to each sprite. Procedures in Scratch 2.0 will only be Stack Blocks, not Reporter or Boolean block styles, and will support recursion. Procedures will take arguments of all three block types. Reporter or boolean procedures will not be available in Scratch 2.0, but may be in future versions.
Procedures in BYOB/Snap!
Procedures in Squeak
- Main article: Squeak Tutorial#Methods
Procedures in Squeak are called methods.