The Object Airkit type is used to group together a set of named values called keys. Each value will be associated with a key, later that value can be retrieved by the same key. An Object is created by a comma separated list of pairs where a name is separated from the value by a colon, enclosed in curly brackets. For example if we wanted to pair foo with 1, bar with 2, and baz with 3 we would write the following Airscript.
Alternatively, instead of just using the keyword foo, a string may be provided. The following Airscript expression will produced the same value as that from the previous example.
This syntax is useful if a key must contain a character that isn't normally allowed in identifiers for example the key foo-bar must be entered with a string because the - character is not allowed.
Using strings as keys also allows one to create objects that have dynamic keys. For example if there is a String Variable named dynamic_object_key that holds a the string "foo", one can use
In order to retrieve the value associated with foo we append a . and then the text foo.
Alternatively, records can also be accessed similarly to lists so we may also access the value associated with foo like so:
Was this article helpful?
0 out of 0 found this helpful