Reference

Video Lessons

Learning Objectives

Commands and Reporters

A procedure can be either a command or a reporter. Either kind of procedure can have zero or more inputs, but commands always have zero outputs and reporters always have exactly one output.

Tank diagrams

One way to tell commands and reporters apart is from their tank diagrams. The tank diagram of a reporter has an outgoing pipe that carries its output. For example, here is the tank for the reporters sum, xcor and first:

sumxcorfirst

Since commands don't report anything, they have no output pipe. Here are tanks for the fd, home and glide commands:

fd homeglide

Commands

Commands are procedures that are used to change the state of projects, pages, turtles, buttons, sliders, text boxes, colors, hyperlinks, media objects, dialog boxes, choosers and the Command Center.

Commands don't report output to other procedures.

Examples of commands: presentationmode, page1, setx, fd, setslider1, set. The following procedures are not commands: xcor, sum, word, get.

Reporters

A procedure that reports output to other procedures is called a reporter. The OP command is used to report output from procedures that you write yourself.

Examples of reporters: color, quotient, first, text1, get. The following procedures are not reporters: freezebg, page1, setc, fd, settext1, set.

Input

Input is the information a procedure needs before it can be invoked. For example, in the following instruction

fd 50

50 is the input to the fd command

Output

Output is the information reported by a reporter. For example, in the instruction below

fd product 5 10

the output of the product reporter is 50.

Setters and Getters

All the setters and getters below either set or get information from the turtle's backpack

Setter (Command) Getter (Reporter)
setx xcor
sety ycor
setheading heading
setsize size
setshape (setsh) shape