Command List

StarLogo supports only a few data types: Booleans, Lists, Numbers, and Strings. There are two booleans, true and false. There are no numeric equivalents to true and false (such as 1 or 0). They must be referred to by name (or by executing a logical operator (=, not=, <, >, <=, >=). A [list of data] is a data list, similar to a list in other versions of Logo. Unlike other Logo languages, however, StarLogo does not enable you to execute a list of data as an instruction (that is, there is no run command). You can create a list of data using the list or sentence commands, or by enclosing the literal elements in []'s. (e.g. setfamily [my mother is nice]). You can create an empty list using []. No elements inside the []'s are evaluated. Note: In this version of StarLogo turtles, patches, and the observer can access a list of data. In StarLogo, numbers have a range that is determined by the version of Java that you are using. In Sun's Java this ranges from approximately -1*10^300 to 1*10^300, and decimals can go down to about 1*10^-300. Values smaller than 1*10^-300 return a value of 0, and values larger than 1*10^300 return a value of "Infinity". Strings are used to refer to filenames and other strings. Strings are written as a string with a quotation mark " at the beginning and the end (e.g. "foo" or "myfile.txt"). If you would like more information about how to declare variables, visit the variables page.

Turtle, Observer

globals [variable-list]

Parameters:
[variable-list] List

Description:
Creates global variables. The variable-list contains one or more names. The globals declaration should be placed at the top of the observer procedures window or the turtle procedures window.

Examples:
globals [variable1 variable2 variable3] Creates globals variable1, variable2, and variable3.

Related Commands:
patches-own turtles-own
Turtle, Observer, Patch

list? thing

Parameters:
thing Number the item, string, list, or variable that you are trying to determine if it is a list

Description:
Returns true if thing is a list.

Examples:
list? 4 returns false.

list? [4] returns true.

Related Commands:
number? word?
Turtle, Observer, Patch

number? thing

Parameters:
thing Anything

Description:
Returns true if thing is a number.

Examples:
number? 5.3 returns true.

number? [3] returns false.

Related Commands:
list? word?
Observer

patches-own [variable-list]

Parameters:
[variable-list] Variable a list of patch variables separated by spaces

Description:
Defines a set of variables to be properties of patches. The [variable-list] contains one or more names separated by spaces

Examples:
patches-own [size value] declares two patch variables - size and value.

Notes:
patches-own must only be used once in any program, and remain outside of any procedures. Typically patches-own is defined once at the top of the Observer Procedures window.

Related Commands:
breeds globals turtles-own
Turtle

turtles-own [list of variables]

Parameters:
[list of variables] List A list of variable names to define as turtle variables

Description:
Defines a set of variables to be properties of turtles. The [list of variables] contains one or more names. This line of code should be placed at the top of the Turtle Command Center. It does not go inside procedures.


A variable name may be followed by a list of state values. This variable may only have the values listed in the state value list. This can be used to assign named constants to a variable instead of using numbers.

Examples:
turtles-own [size energy]

turtles-own [weather [sunny cloudy rainy]]

set weather rainy
set weather cloudy
if weather = sunny [ setcolor yellow ]

Notes:
turtles-own declarations should appear outside of any procedure, usually at the top of the turtle procedures pane.

turtles-own declarations can contain more than one variable. If you have more than one turtles-own, consider consolidating them into a single turtles-own.

Related Commands:
breeds globals patches-own
Turtle, Observer, Patch

word? thing

Parameters:
thing Anything Any value

Description:
Returns true if thing is a word or string.

Examples:
word? 2 returns true

word? [1 2 3] returns false

Notes:
See the Data Types documentation for what constitutes a word or string.

Related Commands:
list? number?