File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
tutorials/scripting/gdscript Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -274,16 +274,19 @@ The following is the list of supported operators and their precedence.
274
274
+--------------------------------------------------------------------------------+-------------------------------------------+
275
275
| ``in `` | Inclusion checker (when used with |
276
276
| | control flow keywords or in a |
277
- | | standalone expression). |
277
+ | | standalone expression) |
278
278
| | |
279
279
| | Content iterator (when used with the |
280
- | | for _ keyword). |
280
+ | | for _ keyword) |
281
281
+--------------------------------------------------------------------------------+-------------------------------------------+
282
- | ``not `` | Boolean NOT |
282
+ | ``not `` ``! `` | Boolean NOT and its |
283
+ | | :ref: `aliases<boolean_operators> ` |
283
284
+--------------------------------------------------------------------------------+-------------------------------------------+
284
- | ``and `` | Boolean AND |
285
+ | ``and `` ``&& `` | Boolean AND and its |
286
+ | | :ref: `aliases<boolean_operators> ` |
285
287
+--------------------------------------------------------------------------------+-------------------------------------------+
286
- | ``or `` | Boolean OR |
288
+ | ``or `` ``|| `` | Boolean OR and its |
289
+ | | :ref: `aliases<boolean_operators> ` |
287
290
+--------------------------------------------------------------------------------+-------------------------------------------+
288
291
| ``if x else `` | Ternary if/else |
289
292
+--------------------------------------------------------------------------------+-------------------------------------------+
Original file line number Diff line number Diff line change @@ -407,6 +407,8 @@ they only reduce readability.
407
407
if (is_colliding()):
408
408
queue_free()
409
409
410
+ .. _boolean_operators :
411
+
410
412
Boolean operators
411
413
~~~~~~~~~~~~~~~~~
412
414
@@ -425,7 +427,7 @@ This can make long expressions easier to read.
425
427
426
428
::
427
429
428
- if (foo and bar) or baz:
430
+ if (foo and bar) or not baz:
429
431
print("condition is true")
430
432
431
433
**Bad **:
@@ -434,7 +436,7 @@ This can make long expressions easier to read.
434
436
435
437
::
436
438
437
- if foo && bar || baz:
439
+ if foo && bar || ! baz:
438
440
print("condition is true")
439
441
440
442
Comment spacing
You can’t perform that action at this time.
0 commit comments