From 820fdbe6b74ad1f6f9b7e080be6a53c05cfa8d23 Mon Sep 17 00:00:00 2001 From: RazerTexz <66409416+RazerTexz@users.noreply.github.com> Date: Tue, 4 Mar 2025 11:21:22 +0500 Subject: [PATCH] String.format() wrong placeholder syntax From: `var string = "I have {} cats.".format([3])` To: `var string = "I have {0} cats.".format([3])` --- tutorials/scripting/gdscript/gdscript_format_string.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/scripting/gdscript/gdscript_format_string.rst b/tutorials/scripting/gdscript/gdscript_format_string.rst index 492961b54f8..a8f8791d383 100644 --- a/tutorials/scripting/gdscript/gdscript_format_string.rst +++ b/tutorials/scripting/gdscript/gdscript_format_string.rst @@ -6,7 +6,7 @@ GDScript format strings Godot offers multiple ways to dynamically change the contents of strings: - Format strings: ``var string = "I have %s cats." % "3"`` -- The ``String.format()`` method: ``var string = "I have {} cats.".format([3])`` +- The ``String.format()`` method: ``var string = "I have {0} cats.".format([3])`` - String concatenation: ``var string = "I have " + str(3) + " cats."`` This page explains how to use format strings, and briefly explains the ``format()``