0 votes

I have been trying to get the following to code to work but it keeps giving me an error,

var story = ("Text"+variable+"Text")

Can anyone help to resolve this issue?

in Engine by (17 points)

1 Answer

+2 votes
Best answer

If you get an error, it would help to share what that error is.

What kind of data is in variable? If it's not a string, then + will give an error. You'll need to convert it to a string: "Text" + str(variable) + "Text".

For more complete string formatting, such as decimal places, etc. see:

by (20,679 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.