Skip to content

Commit 04a1d82

Browse files
committed
document unless
1 parent 9d7bb0c commit 04a1d82

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/reference.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,17 @@ else
668668
print message -- prints: I am very tall
669669
```
670670

671+
The opposite of `if` is `unless`:
672+
673+
```moon
674+
unless os.date("%A") == "Monday"
675+
print "it is not Monday!"
676+
```
677+
678+
```moon
679+
print "You're lucky!" unless math.random! > 0.1
680+
```
681+
671682
### With Assignment
672683

673684
`if` and `elseif` blocks can take an assignment in place of a conditional

0 commit comments

Comments
 (0)