Having lots of variables in a more organised way

Godot Version

Godot 4.2

Question

I wanted to ask if its possible to have lots of variables in a script without having them like:
var x: bool = false
var y: bool = false
var z: bool = false

It’s only to make the code more organised and to try not to have like 20 lines with variables

1 Like

No. It’s sometimes a drag, but that’s coding life.

You should look into arrays and dictionaries, they can open new ideas for you. Also, you don’t have to assign value to each one if you are careful of how you use them later.

Oh, I’ll just mention that you can make vars within funcs (and even with ‘scopes’ like loops etc.) and they are alive only within those scopes. i.e. you don’t have to make them all globally at the top of the file.