Is there no way to do actual integer division so that I don’t get this damn warning about integer division? It’s actually driving me crazy and I don’t want to see warnings about it when I intend for integer division to be done. Since gdscript is python inspired I tried to see if // is a thing but it’s not. Anyone know how to fix this without straight up getting rid of all warnings?
hey there that’s my first time to help someone in godot forum, use // for integer division in GDScript. If you want a float, make sure one number is a float like a / 2.0. This removes the warning without disabling all warnings.
Hi, in GDScript, // actually causes a parse error because only / is a recognised operator.
To do integer division, I usually do something like int(float(x) / y) which looks pretty disgusting but at least it makes the engine happy.
If you really want to do integer division without any extra syntax you can suppress the warning by pressing the “ignore warning” button next to the message, this will add a matching @ignore_warning line.
Alternatively, you can disable all warnings about integer division in the editor settings.
If you need help yourself, please create a separate topic for it, it helps organise the forum