I juste noticed that it's actually impossible to w...
# announcements
t
I juste noticed that it's actually impossible to write the following:
Copy code
for (n in 0.0..1.0 step 0.1)
I know that floating point numbers are imprecise and such a for loop should be avoided. Is this why there is no such construct ? Or are there any alternatives ?
n
As an alternative:
(0..10).map { i -> i / 10.0 }.forEach { f -> ... }
Ô׼ 1
­čÖî 3