String
A string is a character sequence, i.e., a sequence of characters (e.g., letters, digits, special characters, and control characters). Strings must always be written between two single or double quotes."Value1, Value2, Value3, Value4" | String |
'Value1, Value2, Value3, Value4' | String |
Value1, Value2, Value3, Value4 | not a string (quotes missing) |
Concatenation
With the+ operator, it is possible to combine multiple strings.
In this example, we create variables for a greeting and put them together.
Integer
Integers are whole numbers (numbers without decimal places).10 | Integer |
20.00 | not an integer (decimal places present) |
Float
Floats are floating-point numbers with a period as the decimal separator.10.25 | Float |
10,25 | not a float (invalid syntax: comma as decimal separator) |
Converting to float
Other base types can be converted to float:Boolean/Bool (true/false)
A bool is a truth value and can only be true or false.true | truth value true |
false | truth value false |
"true" | not a truth value (wrong syntax: string) |
truthy and falsy
Not only values of the data type bool contain a truth value. Objects of all other data types also have a value property referred to as truthy or falsy. In the context of logical operators and branching, it is important to know when a value is considered true or false. Here is a list of all values that are falsy and are therefore treated as false: ▪ null, the value of the Null data type ▪ false ▪ the number 0 (Integer) or 0.0 (Float) ▪ an empty string ” ” ▪ an empty list [ ] ▪ an empty map All other values are treated as truthy.Converting to boolean
Other base types can be converted to boolean:List
A list is a series of values, comma-separated and enclosed in square brackets. An empty list is written with square brackets containing nothing.[1, 2, 3] | filled list |
[ ] | empty list |
Distinct
If a list contains multiple entries that are identical, this function can be used to remove all duplicate entries. Argumentslist - list to be processed
key - (optional) map key to be used for comparison with other maps.
Example
Merge
Two lists can be merged with each other. Additional information: in addition to using a function, the+ operator ($list1 + $list2) can also be used.
Arguments
target - list to be used as the base for the merge
source - list with which the target should be extended
Map
A map is a list of key-value pairs written inside curly braces. The key and its value are separated by a colon. The individual key-value pairs are separated by commas. An empty map is written with curly braces containing nothing.{ name: "Shirt", price: "12.95", image: "shirt-blue.jpg" } | filled map |
{ "404": "Not found", "301": "Moved Permanently" } | filled map |
{ "Name, Description , Price, Additional info" } | not a map (invalid syntax) |
{ } | empty map |
Merge
Two maps can be merged with each other. With maps, when content differs, the content of the second entry is used. Nested maps can also be taken into account. Argumentstarget - map to be used as the base for the merge
source - map with which the target should be extended
deep - optional flag indicating whether the nesting of maps should be taken into account (default: false)
Example - merging two maps.
