-
Notifications
You must be signed in to change notification settings - Fork 22
Keyword Dictionary
Sean Swezey edited this page Oct 12, 2021
·
16 revisions
Used in several contexts to separate bound variables from the body of the definition.
Indicates if a value is of a specific type, returning true
if so. ?
is as a quasi-optional indicator:
- For datatypes, it can be used to determine if the datatype is a specific value type.
- For classes and traits, it means the type can be the class/trait or
null
.
datatype AorB = A | B
var example := A;
assert example.A?;
class C {}
var cls1: C := new C();
var cls2: C? := null;
Creates a new datatype. It is used to create enums and record/struct types and cannot be null
.
datatype NumberRecord = NumberRecord(intField: int, strField: string)
var threeRecord := NumberRecord(3, "three");
forall
evaluates an expression for each value provided.
Defines a mapping (ie hashmap, dictionary, etc).
Defines a set.