Daniel Queiroz Porto(daniel-queiroz-porto)

What's up with "{velocity = velocity}"? Aren't dictionaries supposed to be "{'velocity': velocity}"?

As there's no error in the editor I'm assuming it's a valid way to declare a dictionary, but what's the difference between them and when should I use one or the other?
  • Nathan Lovato replied

    They're interchangeable syntaxes. One is inherited from python, the other from Lua. In Godot, you can also access the keys of dictionaries like:

  • Daniel Queiroz Porto(daniel-queiroz-porto) replied

    Thanks for the explanation!

    I knew about the python way and the ".key" way but I didn't know about that one! It's fewer character to type, and characters where I don't have to hold down shift, so I might try to get used to this way!

  • Nathan Lovato replied

    You're welcome :)