Skip to content

Commit 8a112dc

Browse files
Add bang operator to operators table (#6558)
* Add bang operator to operators table * Add symbolic aliases for `and` & `or` * Remove comma from operators table * Add bang to the aliases list --------- Co-authored-by: Max Hilbrunner <mhilbrunner@users.noreply.github.com>
1 parent 6095b20 commit 8a112dc

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

tutorials/scripting/gdscript/gdscript_basics.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,16 +274,19 @@ The following is the list of supported operators and their precedence.
274274
+--------------------------------------------------------------------------------+-------------------------------------------+
275275
| ``in`` | Inclusion checker (when used with |
276276
| | control flow keywords or in a |
277-
| | standalone expression). |
277+
| | standalone expression) |
278278
| | |
279279
| | Content iterator (when used with the |
280-
| | for_ keyword). |
280+
| | for_ keyword) |
281281
+--------------------------------------------------------------------------------+-------------------------------------------+
282-
| ``not`` | Boolean NOT |
282+
| ``not`` ``!`` | Boolean NOT and its |
283+
| | :ref:`aliases<boolean_operators>` |
283284
+--------------------------------------------------------------------------------+-------------------------------------------+
284-
| ``and`` | Boolean AND |
285+
| ``and`` ``&&`` | Boolean AND and its |
286+
| | :ref:`aliases<boolean_operators>` |
285287
+--------------------------------------------------------------------------------+-------------------------------------------+
286-
| ``or`` | Boolean OR |
288+
| ``or`` ``||`` | Boolean OR and its |
289+
| | :ref:`aliases<boolean_operators>` |
287290
+--------------------------------------------------------------------------------+-------------------------------------------+
288291
| ``if x else`` | Ternary if/else |
289292
+--------------------------------------------------------------------------------+-------------------------------------------+

tutorials/scripting/gdscript/gdscript_styleguide.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,8 @@ they only reduce readability.
407407
if (is_colliding()):
408408
queue_free()
409409

410+
.. _boolean_operators:
411+
410412
Boolean operators
411413
~~~~~~~~~~~~~~~~~
412414

@@ -425,7 +427,7 @@ This can make long expressions easier to read.
425427

426428
::
427429

428-
if (foo and bar) or baz:
430+
if (foo and bar) or not baz:
429431
print("condition is true")
430432

431433
**Bad**:
@@ -434,7 +436,7 @@ This can make long expressions easier to read.
434436

435437
::
436438

437-
if foo && bar || baz:
439+
if foo && bar || !baz:
438440
print("condition is true")
439441

440442
Comment spacing

0 commit comments

Comments
 (0)