Do NOT enumerate Enumerators
During a take on a Euler Problem, I stumbled upon a quirky behaviour:
(3..100).step(2)
=> #<Enumerator: ...>
so you can do something like this, neglecting .each
:
(3..100).step(2) { |e| e.nil? }
which is a tiny bit faster than using each for iterating.
⬅️ Read previous Read next ➡️