Re: ruby equivalent PHP function is_numeric?

From: Paul L. [mailto:[email protected]]

What purpose does the underscore play? I see that it is
accepted, I just
can’t figure out why. I have never seen it as part of proper numeric
syntax, anywhere, in three decades in this business.

a = 1_2_3_4_5_6_7 # => 1234567

big = 10000000
Quick, is that 1e6 or 1e7 or 1e8?

big = 10_000_000

Gavin K. wrote:

big = 10_000_000

You mean, avoid ambiguous locale-specific group separators “,|.”, yes?

Interesting. Never saw that before. Plenty of underscores, none of them

----- Original Message -----
From: “Paul L.” [email protected]
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” [email protected]
Sent: Friday, November 17, 2006 5:05 PM
Subject: Re: ruby equivalent PHP function is_numeric?

big = 10000000

I think more for input convenience
x = 10000000 => 10000000
y = 10_000_000 => 10000000
z = 10,000,000 => [10, 0, 0]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs