Here is an example of writing a function:

1. make a little blocks program that beats a heart...

2. go into java script view to view 'under the covers' (press the JAVASCRIPT button at the top of the editor)

3. move the beating code into a beat() function with a bit of cut and paste and typing

4. go back to blocks view and see what it has done (press the BLOCKS button at the top of the editor)

5. use the beat() function (copy and paste) multiple times to create a bigger program, showing how a function allows reuse

Keywords for search: functions