Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

GDScript

< >

GDScript is a programming language created in 2008.

#607on PLDB 16Years Old 39kRepos
Homepage

GDScript is a high level, dynamically typed programming language used to create content. It uses a syntax similar to Python (blocks are indent-based and many keywords are similar). Its goal is to be optimized for and tightly integrated with Godot Engine, allowing great flexibility for content creation and integration.


Example from the web:
# A file is a class! # Inheritance extends BaseClass # Member Variables var a = 5 var s = "Hello" var arr = [1, 2, 3] var dict = {"key": "value", 2:3} # Constants const ANSWER = 42 const THE_NAME = "Charly"
Example from hello-world:
extends Node2D func _ready(): print("Hello World")
Example from Linguist:
# Taken from https://github.com/okamstudio/godot/wiki/gdscript # a file is a class! # inheritance extends BaseClass # member variables var a = 5 var s = "Hello" var arr = [1, 2, 3] var dict = {"key":"value", 2:3} # constants const answer = 42 const thename = "Charly" # built-in vector types var v2 = Vector2(1, 2) var v3 = Vector3(1, 2, 3) # function func some_function(param1, param2): var local_var = 5 if param1 < local_var: print(param1) elif param2 > 5: print(param2) else: print("fail!") for i in range(20): print(i) while(param2 != 0): param2 -= 1 var local_var2 = param1+3 return local_var2 # subclass class Something: var a = 10 # constructor func _init(): print("constructed!") var lv = Something.new() print(lv.a)

Language features

Feature Supported Example Token
Integers ✓ # \d+j?
Floats ✓ # (\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?
Hexadecimals ✓ # 0[xX][a-fA-F0-9]+
Strings ✓ "Hello world" "
Print() Debugging ✓ print
Comments ✓ # A comment
Line Comments ✓ # A comment #
Semantic Indentation X

- Build the next great programming language · Add · Issues · About · Search · Keywords · Livestreams · Labs · Resources · Acknowledgements

Built with Scroll v154.3.0