0 votes

Basically trying to do something like

dictionary {
var 1 = a
var 2 = b
var 3 = c
}

The problem happens when var 1-3 happens to share same word with a keyword like str or tan. Is there way to keep variable name? @"str" does not seem to do it.

in Engine by (44 points)

1 Answer

+1 vote
Best answer

Something like this?

var dict = {
    "str": "str keyword",
    "tan": "tan keyword",
    "PI": 3.14
}
by (306 points)
selected by

Returns : Unexpected assign.
Plus I also have variables in dictionary values.

Show your code. It should work.

Also, variables as values is no problem...

var x = 2
var dict = {
    "x": x
}

True, pardon me, used = instead of :, it working.

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.