Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Tort |
var test = 1.0
if test in range(0.9, 1.1):
print(1111)
not print
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Tort |
var test = 1.0
if test in range(0.9, 1.1):
print(1111)
not print
Reply From: | hilfazer |
I did this
print ( range(0.9, 1.1) )
and it returned [0]
. I don’t think range can work with floating point numbers. When you do this:
if test in range(0.9, 1.1, 0.1):
Godot will complain that step
can’t be zero (0.1 was truncated to 0).