Skip to content

Commit ea4d3b3

Browse files
committed
ternary operator
1 parent 1dfbac9 commit ea4d3b3

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

content/posts/jai-guide.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,15 @@ for a: arr {
9393

9494
## Ternary Operator
9595

96-
todo
96+
jai uses `ifx` as its ternary operator, the syntax is `ifx condition then value else value`, but `then` is optional:
97+
98+
```jai
99+
a := 0;
100+
b := 100;
101+
102+
c := ifx a > b 10 else 1000; // without explicit then
103+
d := ifx a > b then 10 else 1000; // with explicit then
104+
```
97105

98106
## References
99107

0 commit comments

Comments
 (0)