system
1
|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
DimitriyPS |
|
Old Version |
Published before Godot 3 was released. |
I need to get an int by rounding to float.
Wrong: 8.83=8
Correct: 8.83=9
Which method to use?
system
4
|
|
|
|
Reply From: |
fredspipa |
Check out round(float).
int(round(8.83))
gives you the integer 9.
Edit: someone pointed out to me that round() returns a float that happens to have no decimal numbers. Updated code snippet.