Skip to content

Commit

Permalink
Document the ternary operator
Browse files Browse the repository at this point in the history
  • Loading branch information
ogoffart committed Oct 11, 2021
1 parent acf2ef3 commit f0f264a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion docs/langref.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,20 @@ Example := Rectangle {
}
```

The ternary operator `... ? ... : ...` is also supported, like in C or JavaScript:

```60
Example := Rectangle {
touch := TouchArea {}
background: touch.pressed ? #111 : #eee;
border-width: 1px;
border-color: !touch.enabled ? #888
: touch.pressed ? #aaa
: #555;
}
```


### Strings

Strings can be used with surrounding quotes: `"foo"`.
Expand Down Expand Up @@ -541,7 +555,7 @@ Calling a callback
clicked => { root.some-callback(); }
```

Conditional expression
Conditional statements

```ignore
clicked => {
Expand Down

0 comments on commit f0f264a

Please sign in to comment.