Browse Source

Added info about range with negative step

Added info about range with a negative step, because I have a lot of questions "how can I get a reversed range in GDScript?" in my local community.
Max 2 years ago
parent
commit
07175e60a0
1 changed files with 3 additions and 0 deletions
  1. 3 0
      tutorials/scripting/gdscript/gdscript_basics.rst

+ 3 - 0
tutorials/scripting/gdscript/gdscript_basics.rst

@@ -1137,6 +1137,9 @@ in the loop variable.
     for i in range(2, 8, 2):
         statement # Similar to [2, 4, 6] but does not allocate an array.
 
+    for i in range(8, 2, -2):
+        statement # Similar to [8, 6, 4] but does not allocate an array.
+
     for c in "Hello":
         print(c) # Iterate through all characters in a String, print every letter on new line.