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]
List |
globals [variable1 variable2 variable3]
Turtle, Observer, Patch |
list? thing
Number | the item, string, list, or variable that you are trying to determine if it is a list |
list? 4
list? [4]
Turtle, Observer, Patch |
number? thing
Anything |
true
number? 5.3
true
number?
false
Observer |
patches-own [variable-list]
Variable | a list of patch variables separated by spaces |
patches-own [size value]
patches-own
patches-own
Turtle |
turtles-own [list of variables]
List | A list of variable names to define as turtle variables |
A variable name may be followed by a list of state values
turtles-own [size energy]
turtles-own [weather [sunny cloudy rainy]]
set weather rainy
set weather cloudy
if weather = sunny [ setcolor yellow ]
turtles-own
turtles-own
turtles-own
turtles-own
Turtle, Observer, Patch |
word? thing
Anything | Any value |
word? 2
word? [1 2 3]