Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.


Inherits: RefCounted < Object

A class that stores an expression you can execute.


An expression can be made of any arithmetic operation, built-in math function call, method call of a passed instance, or built-in type construction call.

An example expression text using the built-in math functions could be sqrt(pow(3, 2) + pow(4, 2)).

In the following example we use a LineEdit node to write our expression and show the result.

var expression = Expression.new()

func _ready():

func _on_text_submitted(command):
    var error = expression.parse(command)
    if error != OK:
    var result = expression.execute()
    if not expression.has_execute_failed():
        $LineEdit.text = str(result)