Menu
CoddyTech

Basic Program Structure

Part of the Fundamentals section of Coddy's GDScript journey. Lesson 4 of 92.

Every program in this course has the same frame:

extends Node

func _ready():
	print("Hello, Coddy!")

extends Node is the first line of the script. In Godot, a game is built from nodes, and this line makes the script a node.

func _ready(): defines the function Godot calls when the node is ready. Your program starts there, and its statements run from top to bottom.

The colon (:) at the end of func _ready(): starts a block. Every statement inside the block is indented by one level. Godot indents with tabs; use the same indentation on every line of a block.

GDScript does not need a semicolon at the end of a statement. Each statement goes on its own line.

challenge icon

Challenge

Beginner

This program has two mistakes in its structure, so it does not run. Fix it so it prints:

Ready!
Let's go!
  • Add the missing colon at the end of func _ready()
  • Indent both print() lines by one level

Try it yourself

extends Node

func _ready()
print("Ready!")
print("Let's go!")
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals

Practice on your own: Online GDScript compiler