| Operator | Type | Description | Example |
|---|---|---|---|
++ |
List | Concatenates two lists | [1, 2] ++ [3, 4] → [1, 2, 3, 4] |
// |
Attribute Set | Merges two attribute sets | { a = 1; } // { b = 2; } → { a = 1; b = 2; } |
+ |
Number | Adds two numbers | 5 + 3 → 8 |
* |
Number | Multiplies two numbers | 6 * 2 → 12 |
== |
Generic | Equality check | foo == bar → true if foo equals bar |
!= |
Generic | Inequality check | foo != bar → true if foo is not bar |
&& |
Boolean | Logical AND | true && false → false |
| ` | ` | Boolean | |
! |
Boolean | Logical NOT | !true → false |
? |
Attribute Set | Checks if a key exists | foo ? bar → true if bar exists in foo |
or |
Generic | Default if the first is null |
config.myOption or "default" |
//= |
Attribute Set | Merges, with LHS assigning RHS | { a = { }; } //= { b = 2; } → { a.b = 2; } |
Tags: #Linux