[#409331] Capture HTML table data, pass to Ruby, pass back and display result in HTML text field — Hubert Wagner <lists@...>

Hello :

11 messages 2013/08/04

[#409336] Rakefile Error - Please Help — "Jennifer T." <lists@...>

Hi,

13 messages 2013/08/04
[#409341] Re: Rakefile Error - Please Help — Hassan Schroeder <hassan.schroeder@...> 2013/08/04

On Sun, Aug 4, 2013 at 7:41 AM, Jennifer T. <lists@ruby-forum.com> wrote:

Why does the next() method behave this way?

From: asdfasdf asdfasdf <lists@...>
Date: 2013-08-05 03:19:00 UTC
List: ruby-talk #409363
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 =E2=80=9Ccarry,=E2=80=9D 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 create a carry?  Is it
only z to a and Z to A?  Why?

Thanks!

-- =

Posted via http://www.ruby-forum.com/.=

In This Thread

Prev Next