Line 1: Line 1:
 
{{unreleased}}
 
{{unreleased}}
 
{{redirect|Methods|Squeak methods|Squeak Tutorial#Methods}}
 
{{redirect|Methods|Squeak methods|Squeak Tutorial#Methods}}
'''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 Squeak or Java code executed all at once.
+
'''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 Squeak or Java code executed all at once. Procedures have inputs or [[Arguments]].
  
 
==Procedures in Scratch==
 
==Procedures in Scratch==

Revision as of 14:05, 29 April 2012

Clock.png 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.
"Methods" redirects here. For Squeak methods, see Squeak Tutorial#Methods.

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 Squeak or Java code executed all at once. Procedures have inputs or Arguments.

Procedures in Scratch

A "jump" procedure.
A "jump" procedure with an argument.

In Scratch 2.0, procedures will be implemented.[1] There will be a "My Blocks" section, where procedures in the project are stored.[2] The procedures will be local to each sprite.[citation needed] Procedures in Scratch 2.0 will only be Stack Blocks, not Reporter or Boolean block styles. It remains to see whether they will be recursive or not. Procedures are expected to take arguments.

Procedures in BYOB/Snap!

Snap!, previously called BYOB (Build Your Own Blocks), is a Scratch modification that allows procedures. Snap!'s procedures allow all 3 types of blocks, with arguments, and also recursion.

References

  1. http://blog.scratch.mit.edu/2011/03/scratch-20-progress-report-create-your.html
  2. http://blog.scratch.mit.edu/2012/02/scratch-20-project-page-and-project.html