Primordial Patterns & Values
At the core of every pattern ultimately lies primordials. They can be viewed as the foundational atoms from which all else grows.
The primordial patterns are:
-
boolean
-
string
-
integer
-
decimal
The boolean
pattern
The boolean
primordial matches any boolean value; either true
or false
.
This is dependent on the input value serialization method used. In YAML, the string no can occasionally be interpreted as false .
|
This pattern denotes that a field must contain a boolean value:
pattern dog = {
trained: boolean
}
In addition to specifying the general boolean
pattern, the values of true
and false
may also be used, to restrict acceptable inputs to exactly match true
or false
.
pattern trained-dog = {
trained: true
}
The string
pattern
The string
primordial pattern matches any string as input.
For instance, this pattern named
will match any string:
pattern named = string
Any actual string value in a pattern represents a string that exactly matches the string.
For example, this pattern named-bob
will only match the string "bob"
:
pattern named-bob = "bob"