-
Notifications
You must be signed in to change notification settings - Fork 99
Literals
(some literal expressions are also described in data types)
A literal is a way to specify an unnamed constant value corresponding to a given data type. GAML supports various types of literals for often — or less often — used data types.
Values of simple (i.e. not composed) types can all be expressed using literal expressions. Namely:
-
bool:
true
andfalse
. -
int: decimal value, such as
100
, or hexadecimal value if preceded by'#'
(e.g.#AAAAAA
, which returns the int11184810
) -
float: the value in plain digits, using
'.'
for the decimal point (e.g.123.297
) -
string: a sequence of characters enclosed between quotes (
'my string'
) or double quotes ("my string"
)
Although they are not strictly literals in the sense given above, some special constructs (called literal constructors) allow the modeler to declare constants of other data types. They are actually operators but can be thought of literals when used with constant operands.
-
pair: the key and the value separated by
::
(e.g.12::'abc'
) -
list: the elements, separated by commas, enclosed inside square brackets (e.g.
[12,15,15]
) -
map: a list of pairs (e.g.
[12::'abc', 13::'def']
) -
point: 2 or 3 int or float ordinates enclosed inside curly brackets (e.g.
{10.0,10.0,10.0}
)
Finally, a special literal, of type unknown
, is shared between the data types and all the agent types (aka species). Only bool
, int
and float
, which do not derive from unknown
, do not accept this literal. All the others will accept it (e.g. string s <- nil;
is ok).
-
unknown:
nil
, which represents the non-initialized (or, literally, unknown) value.
- Installation and Launching
- Workspace, Projects and Models
- Editing Models
- Running Experiments
- Running Headless
- Preferences
- Troubleshooting
- Introduction
- Manipulate basic Species
- Global Species
- Defining Advanced Species
- Defining GUI Experiment
- Exploring Models
- Optimizing Model Section
- Multi-Paradigm Modeling
- Manipulate OSM Data
- Diffusion
- Using Database
- Using FIPA ACL
- Using BDI with BEN
- Using Driving Skill
- Manipulate dates
- Manipulate lights
- Using comodel
- Save and restore Simulations
- Using network
- Headless mode
- Using Headless
- Writing Unit Tests
- Ensure model's reproducibility
- Going further with extensions
- Built-in Species
- Built-in Skills
- Built-in Architecture
- Statements
- Data Type
- File Type
- Expressions
- Exhaustive list of GAMA Keywords
- Installing the GIT version
- Developing Extensions
- Introduction to GAMA Java API
- Using GAMA flags
- Creating a release of GAMA
- Documentation generation