Expected end of statement after variable declaration, found "Identifier" instead in Godot 4

By Eduardo Orellana · Updated

A statement ended and something else followed it on the same line. var a = 5 print(a) fails to parse with Expected end of statement after variable declaration, found "Identifier" instead. Put each statement on its own line, or separate them with a semicolon.

AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.

Intel or AMD Chromebook, with Linux turned on.

Download for macOSDownload for Windows

What Godot is checking

After a complete statement the parser expects a newline or a semicolon. When it finds another token instead, it reports what kind of statement had just ended and what token came next.

The context changes with the statement: after expression, after return statement, after "pass". A missing operator between two values, such as speed delta, gives the same message after expression.

Reproduce it

A declaration and a print on one line.

extends Node

func _ready() -> void:
	var a = 5 print(a)

What Godot 4.7.2 prints

Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

SCRIPT ERROR: Parse Error: Expected end of statement after variable declaration, found "Identifier" instead.
   at: GDScript::reload (res://answers/expected-end-of-statement-after-variable-declaration/repro.gd:4)
ERROR: Failed to load script "res://answers/expected-end-of-statement-after-variable-declaration/repro.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript_resource_format.cpp:46)

Fix it

One statement per line, or a semicolon between them.

extends Node

func _ready() -> void:
	var a = 5
	print(a)
	var b = 6; print(b)

What the fixed script prints

Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

5
6

Verified on Godot 4.7.2

Both scripts on this page were run headless on Godot 4.7.2 (4.7.2.stable.mono.official.ed1daf0bf) on 18 October 2026, and the output above is what Godot printed, unedited.

Where the check lives in Godot's source: [gdscript_parser.cpp line 695, the message](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_parser.cpp#L695), [gdscript_parser.cpp line 1296, the variable declaration context](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_parser.cpp#L1296).

More on this: setget in Godot 4: Expected end of statement after variable declaration, found "Identifier" instead

Questions

Are semicolons allowed in GDScript?
Yes, as a separator between statements on one line. They are optional at the end of a line, and Godot's style guide leaves them out.
What does found "Identifier" mean?
The next token was a name, here print. Other values name other tokens, such as found "(" or found "Literal".