4 ms·
> Nothing implicit happens behind your back. And then, we have repeat i in range(0, n, 1) with an implicit “i = i + n”, followed by an implicit comparison.
by Someone 8mo ago
> Nothing implicit happens behind your back.
And then, we have
repeat i in range(0, n, 1)
with an implicit “i = i + n”, followed by an implicit comparison.
Also, range(0, n, 1) looks like a function call, but isn’t one, is it? Or an i write
evenDigits = range(0, 10, 2)
I think introducing a range type would be cleanest, but I think clarity would improve even more by giving up more on “Nothing implicit happens behind your back”. Allowing
for num in nums {…}
has quite a bit of magic, but IMO is clearer than iterating over indexes, followed by superfluous checks whether indexing succeeded.