Re: Number underscored gone wrong

Kevin Deisz <[email protected]> Tue, 17 Sep 2019 11:15:21 -0400
Newsgroups gmane.comp.lang.ruby.general
Message-ID <CALzDYJ0du6J6Nv8rzvotUy9+QakvuWEZi=m=FZx+z1az6NPwvA@mail.gmail.com>
When you prefix a number with a 0, it's interpreted in octal. Hence, 5 * 8
= 40.

On Tue, Sep 17, 2019 at 11:13 AM Peter L <[email protected]> wrote:

> Dear ruby fans...
>
> Just a quick question: I always thought underscores in numbers were
> ignored, like 100_000, 10_00 or 666_6.
>
> Buuut: did anyone of you tried to do following?
>
> > 0_50
>
> WTH :)
>
> Really - try it :)
>
> Would be great if someone could answer why this is not working as I
> imagined? :)
>
> Have a nice afternoon!
>
> Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
>


-- 
*Kevin D. Deisz*
CTO, CultureHQ <https://www.culturehq.com>


Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>