Review of Words and Lists
Before we get started talking about instruction lists, let's review a little about words and lists.
We know that words are a group of characters that usually start with a quotation mark, like:
"ball "yx%q "Dolores
Numbers are a special kind of word that don't need quotation marks:
8 34 0.1
Words are used as input by commands and reporters:
fd 50 ; fd is a command that needs one input. fd likes numbers for its input.
There are reporters that output words. For example, xcor, ycor, heading, sum and random all output numbers.
show word "star "fish
There are also commands and reporters that like lists as input. For example:
setpos [-40 22]
There are also reporters that report lists, but we will save them for another lesson.
What's important for now is this:
Words or lists can be inputs or outputs of a procedure
Lists in the Command Center and Lists in Procedure Tabs
Lists are treated a little differently in the Command Center and Procedure Tabs.
In the Command Center, Foo decides a list is finished when:
Foo sees a closing bracket, like the ] in [-40 22] OR
In the Procedures Tab, Foo has a different way of deciding if instructions are complete. Foo uses key words like to and end to mark the beginning and end of the group of instructions that make up the procedure (Foo can also mark the end of a procedure with the key words stop, output, or stopall, which we will talk about in another lesson).
So, in the Procedures Tab, a list can begin on one line and end on another:
This is convenient for programmers like you, because it means you can write procedures that are easier to read.
Writing Procedures with Instruction Lists
Inside procedures, you can also write instruction lists that start on one line and end on another:
About the Center for Talent Development
Center for Talent Development (CTD), housed at Northwestern University's School of Education and Social Policy, is an accredited learning center and research facility that identifies, educates and supports gifted students and their families and serves as a leader in gifted education. Learn more about the Center for Talent Development.