Skip to content

Commit a5d7427

Browse files
Sainanwell-in-that-case
authored andcommitted
Document increment operator
This got lost when the new operators section was merged into a single page.
1 parent 9ba6107 commit a5d7427

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/New Operators.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ a += 1
3535
Compound operators are syntactic sugar. They'll call the same metamethods as their non-compound counterparts.
3636
:::
3737

38+
## Increment Operator
39+
In addition to the compound operator `+=`, there is an even faster way to increment a value by 1 using the prefixed ++ operator:
40+
```pluto
41+
local a = 1
42+
print(++a) --> 2
43+
++a
44+
print(a) --> 3
45+
```
46+
3847
## Comparison Chaining
3948
The `<`, `<=`, `>`, and `>=` operators can now be chained successively.
4049

0 commit comments

Comments
 (0)