set¶
Syntax¶
Parameters¶
x- A name of a variable, a list-variable or a table variable.
y- An expression with the same type as
x. index- An expression who value is treated as an index if
xis a list-variable an as a key ifxis a table variable. index-list- A list-expression who values are treated as a list of keys if
xis a table variable. value- A expression that evaluates to a numeric value.
Description¶
This action updates a variable, a list element, or one or more items in a table.
The user usually invokes this action using the = sign as shown below:
x = y # translates to set(x,y)
Some_list[index] = value # translates to set(Some_list, index, value)
Some_table[index] = value # translates to set(Some_table, index, value)
Some_table[index-list] = value # translates to set(Some_table, index-list, value)
A compiler error results if the type or number of arguments is not consistent with the type of the first argument.
Examples¶
Give one or more examples of this item.
my_y = x * 2
my_friend_list = some_list_of_agents
my_friend_list[10] = some_agent_id
my_lookup_table = some_other_table
my_lookup_table[some_agent_id] = ask(agent_id, age)