Search
 
SCRIPT & CODE EXAMPLE
 

GDSCRIPT

gdscript for loop

# loop for n = 0 to 7
for n in 8:
    print(n)

# Using range
for n in range(8):
    print(n)

# loop for n = 10 to 12
for n in range(10,13):
    print(n)

# count down from 10 to 1
for n in range(10,0,-1):
    print(n)

# loop for n = 2,4,6,8 in steps of 2
for n in range(2,9,2):
    print(n)

# Iterate over string (array of characters)
for ch in "Hello":
    print(ch)

# Iterate over an array of numbers
for x in [3,6,8,9]:
    print(x)

# Iterate over items of a dictionary
var dict = { "x": 1, "y": 2, "z": 3 }
for key in dict:
    # Insert the key and value into a text string
    print("index: %s, value: %d" % [key, dict[key]])

# Using continue and break statements
for n in 9:
    # Skip numbers below 3
    if n < 3:
        continue
    # Break out of the loop for numbers above 5
    if n > 5:
        break
    print(n)
Comment

PREVIOUS NEXT
Code Example
Gdscript :: godot find_node() 
Gdscript :: godot 2d set position to mouse 
Gdscript :: GAScript - Google Sheets - QBO API - Consent Dialogue Box 
Clojure :: clojure read file line by line 
Clojure :: ex: Clojure define expected time 
Abap :: abap last row in loop 
Lisp :: magit pull request 
Assembly :: using shape property in flutter for circular corner 
Assembly :: ror loading webview: Error: Could not register service workers: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state.. 
Assembly :: how to open chrome in vbscript 
Assembly :: iterate over tqdm range 
Assembly :: io mapped io and memory mapped io in 8085 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: window load jquery 
Javascript :: clean gradle react android 
Javascript :: toggle text jquery 
Javascript :: JavaScript that executes after page load 
Javascript :: javascript void(0) href 
Javascript :: jquery reload page 
Javascript :: java script converting text to slug 
Javascript :: change src of iframe jquery 
Javascript :: change input to required jquery 
Javascript :: return current date in javascript 
Javascript :: javascript random color generator 
Javascript :: sleep for 1 second 
Javascript :: fetch json post 
Javascript :: exclude node_modules from tree command 
Javascript :: mongoose nestjs installation 
Javascript :: generating component in angular without spec file 
Javascript :: number with commas js 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =