A Ruby iterator is a method that expects a code block. The method can run that block with `yield`, passing control back to the block before continuing. Iterators use this pattern to repeat work or process values. section 6.3.1 section 6.5
Iterating over bytes
`each_byte` runs the supplied block once for each byte in a string. For example, `str.each_byte { |b| puts b }` prints the string's byte values. section 10.9.3
An iterator and an enumerator are related, but they are different kinds of things:
- An iterator is a method; its call runs as a whole and does not retain position between calls. section 10.10.3
- An enumerator is an object that can remember its position. Many built-in iterators return one when called without a block, allowing further method calls to be chained. section 10.10.3 section 10.9.3
>> str.each_byte
=> #<Enumerator: "Hello":each_byte>
This blockless `each_byte` call returns an enumerator instead of immediately iterating through the string. section 10.9.3














