0% found this document useful (1 vote)
1K views2 pages

Gdscript Cheat Sheet - Declaring Variables

The document provides a cheat sheet on using GDScript with examples of declaring variables, using arrays, if statements, loops, and functions. It shows how to declare variables of different data types, append to arrays, use comparison operators and logical operators in if statements, iterate with for and while loops, and define functions with and without parameters.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
1K views2 pages

Gdscript Cheat Sheet - Declaring Variables

The document provides a cheat sheet on using GDScript with examples of declaring variables, using arrays, if statements, loops, and functions. It shows how to declare variables of different data types, append to arrays, use comparison operators and logical operators in if statements, iterate with for and while loops, and define functions with and without parameters.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

GDScript Cheat Sheet 

 
- Declaring variables: 
- var x = 10 
- var y = 10.5 
- var z = “Hello World!” 
- Arrays: 
- var my_array = [0,1,2,3] # array = [0,1,2,3] 
- my_array.append(10) # array = [0,1,2,3,10] 
- If statements: 
- And syntax: 
-​ and ​<OR> && 
- Or syntax: 
​ - or ​<OR> || 
- Greater than/ Greater than or equal to: 
- >  
- >= 
- Less than / Lass or equal to: 
- <  
- <= 
- if x > 5 and x < 10: 
#do something 
elif x >= 10 and x < 20: 
#do something 
else: 
#do something else 
- if z == “Hello World!”: 
#do something 
- if x > 5 and y <= 15: 
#do something 
- Loops: 
- For: 
- for counter in range(0,10): 
print(counter) # prints 0, then 1, then 2 …then 9 
#counts from 0 to 9, iterates 10 times 
- While: 
- var counter = 0 
while counter < 10: 
# do something 
Counter += 1 
- Functions: 
- func do_something(): 
#do something 
- func do_something(parameter1, parameter2): 
#do something 

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy