CodeBlanks Logo Icon CodeBlanks

Output with print

Learn to print to the console with print.

Console output with print

In GDScript, the print() function is used to inspect runtime states, variable contents, and test messages. Outputs appear in the Output panel docked at the bottom of Godot.

func _ready():
    print("Game started successfully!")
    var coins = 5
    print("Coins: " + str(coins))

When concatenating numbers with strings, convert them using the str() function.

Debugging and Trace

Tracing execution flow step by step is the fastest way to troubleshoot logic bugs during development. Beyond standard print(), Godot provides print_debug() which logs the script file and line number.

# Detailed console log for debugging
print_debug("Critical level checked!")

Console outputs enable easy tracking of background computations while the scene runs live.

Practice Print status and code output

Assign "Ready" to status and 200 to code. Print Status: Ready | Code: 200 to the console.

Starter code

Player.cs
extends Node

func _ready():
    # status ve code degiskenlerini tanimlayip konsola yazdir
    pass

Sample solution

Player.cs
extends Node

func _ready():
    var status = "Ready"
    var code = 200
    print("Status: " + status + " | Code: " + str(code))

Expected output

Status: Ready | Code: 200

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which command is used in GDScript to output runtime variable values to the editor console?

  • cout()
  • console.write()
  • echo()
  • print() Correct answer

Explanation: print() is the fundamental GDScript function that writes text and data to the Godot Output panel.

2 Print completion message to console

Question
____("Level Completed")
Answer
print("Level Completed")

Explanation: The print function is called to write text to the Godot console.

3 Console and trace terms

Term Meaning
print Function printing text to console
Output Panel Editor panel for console outputs
trace Tracking execution step by step
str() Converter turning values to text

All lessons in Beginner