From a5d7427cbcf449416a4711fbb263c1b19a489692 Mon Sep 17 00:00:00 2001 From: Sainan Date: Sun, 17 Nov 2024 01:20:29 +0100 Subject: [PATCH] Document increment operator This got lost when the new operators section was merged into a single page. --- docs/New Operators.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/New Operators.md b/docs/New Operators.md index 07542d06..5b905e7a 100644 --- a/docs/New Operators.md +++ b/docs/New Operators.md @@ -35,6 +35,15 @@ a += 1 Compound operators are syntactic sugar. They'll call the same metamethods as their non-compound counterparts. ::: +## Increment Operator +In addition to the compound operator `+=`, there is an even faster way to increment a value by 1 using the prefixed ++ operator: +```pluto +local a = 1 +print(++a) --> 2 +++a +print(a) --> 3 +``` + ## Comparison Chaining The `<`, `<=`, `>`, and `>=` operators can now be chained successively.