Skip to content

Commit 820fdbe

Browse files
authored
String.format() wrong placeholder syntax
From: `var string = "I have {} cats.".format([3])` To: `var string = "I have {0} cats.".format([3])`
1 parent da17e45 commit 820fdbe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tutorials/scripting/gdscript/gdscript_format_string.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ GDScript format strings
66
Godot offers multiple ways to dynamically change the contents of strings:
77

88
- Format strings: ``var string = "I have %s cats." % "3"``
9-
- The ``String.format()`` method: ``var string = "I have {} cats.".format([3])``
9+
- The ``String.format()`` method: ``var string = "I have {0} cats.".format([3])``
1010
- String concatenation: ``var string = "I have " + str(3) + " cats."``
1111

1212
This page explains how to use format strings, and briefly explains the ``format()``

0 commit comments

Comments
 (0)