I might be getting tripped up on something not important, but hopefully
one of y’all can help me understand this
What is a use case where you’d want next() to behave the way it does?
See this from irb:
puts “bay”.next
baz
puts “baz”.next
bba
puts “bzz”.next
caa
puts “zzz”.next
aaaa
puts “ZZZ”.next
AAAA
The manual says this is because:
“If the increment generates a “carry,” the character to the left of it
is incremented. This process repeats until there is no carry, adding an
additional character if necessary.”
http://www.ruby-doc.org/core-2.0/String.html#method-i-next
Come again? What exactly causes an increment to generate a carry? Is
it
only z to a and Z to A? Why?
Thanks!