Hello! In our previous lesson, you created a home for your game's logic by attaching a GDScript to your sprite. You learned about the special _ready() function, which Godot runs automatically when your node first appears. Right now, it contains a single pass keyword, patiently waiting for instructions.
Today, you'll replace that placeholder and write your very first line of executable code. We'll be using the print() function. This simple command is one of the most powerful tools in a developer's arsenal. It allows you to send messages from your code to a console in the editor, giving you a window into what your game is doing behind the scenes. Mastering print() is the first step toward debugging your code and bringing your game ideas to life.
Your First Command: Talking to the Console
Before we write any code, let's understand our goal. We want to make our script send a message that we can read. In Godot, these messages appear in a special panel called the Output console, which is usually located at the bottom of the editor.
Think of the print() function as a way for your script to talk to you, the developer. It's not something the player will ever see. Instead, you'll use it to check if a piece of code is running, to see the value of a piece of data at a specific moment, or to track the flow of your program. This process is called debugging, and it's a fundamental skill in all programming.

The article "GDScript Print Tutorial" from GameDev Academy provides a great overview of why this seemingly simple function is so essential for developers.
GDScript Print Tutorial - Complete Guide - GameDev Academy
This article explains the core purpose of the print command. As you read, focus on the "why" behind using it.
Read the introduction and the section Why learn GDScript print? to understand its importance as a debugging tool.
From pass to print
Now, let's put this into practice. It's time to replace the pass keyword in your script with a real instruction.
- Open your
player.tscnscene and select your player sprite node. - Click the script icon next to the node's name to open your
player.gdscript in the editor. - Find the
_ready()function. - Delete the line with
pass. - In its place, making sure to keep the indentation (one tab stop), type the following line:
print("Hello, World!")
Your _ready() function should now look like this:
# Called when the node enters the scene tree for the first time.
func _ready():
print("Hello, World!")
Let's break down this line:
printis the name of the built-in function we are calling.- The parentheses
()after the function name are where we place the information we want it to work with. This information is called an "argument". - The quotation marks
""tell GDScript that the text between them is a string, which is the programming term for a sequence of text characters. - The indented tab before the line is crucial. GDScript uses indentation to know that this
printcommand belongs to the_readyfunction.
Running the Scene and Seeing the Result
With your new code in place, let's run the game and see it in action.
- Save your script by pressing
Ctrl+S(orCmd+Son macOS). - Run the current scene by pressing
F6(or clicking the "Run Current Scene" button in the top-right of the editor, which looks like a little film clapperboard).
The game window will appear, which will still be empty except for your sprite. But the real action is back in the editor. Look at the Output panel at the bottom. You should see your message: "Hello, World!".
For a complete visual walkthrough of this entire process, the following video by Omogonix is an excellent guide. It clearly shows how to write the print statement and where to find the output.
Godot 4 GDScript Tutorial | Part 1 - Creating Scripts, Basic Functions, Printing Strings, Comments
This video demonstrates how to use print() in both the _ready() and _process() functions and shows the results in the console.
Watch the segment from the beginning of the demonstration where the host adds a print statement to the _ready() function, runs the scene, and shows the output. Pay close attention to the connection between the code they write and the message that appears in the console.
The difference between putting print() in _ready() (runs once) versus _process() (runs every frame), as shown in the later part of the video, is a critical concept that we will revisit often. For now, using _ready() is perfect for our setup.
The official Godot documentation also provides a concise "Hello, world!" example that confirms what you've just done.
Creating your first script - Godot Docs
This official guide walks through the same "Hello, world!" exercise. It's a great reference to solidify your understanding.
Find the section titled Hello, world! and read through the instructions. Note that it uses a function called _init(), which is very similar to _ready() for this purpose. The key takeaway is the structure: define a function, and use print() inside it.
Conclusion
Congratulations! You have officially written and executed your first line of GDScript code. It may seem like a small step, but you've just unlocked the fundamental feedback loop of programming: write code, run it, and observe the result.
Here are the key takeaways from this lesson:
- The
print()function is a command that writes messages to the Output console in the Godot editor. - It is an essential tool for debugging—verifying that your code is running and understanding its behavior.
- The basic syntax is
print("Your message here"), where the text in quotes is called a string. - Code inside the
_ready()function executes once, right when the game starts, making it a perfect place to print a "start" message.
You can now send static messages to the console. But what if you wanted to print something that can change, like a player's score or health? To do that, we need a way to store and manage data. In our next lesson, we will introduce variables, the building blocks for creating dynamic game logic.