Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Hash assignment (what's happening?
Quiroz, Hector
10/5/2007 2:16:00 PM
From within irb, I'm creating a hash and populating it with the
following data.
irb(main):007:0> {:QHector => 1967, :WKelly => 2551, :ECron => 0220,
:VLaura => 4003, :LWalter => 1188}
Why is the value for the ':ECron' coming back as 144 instead of 0220?
=> {:ECron=>144, :VLaura=>4003, :LWalter=>1188, :QHector=>1967,
:WKelly=>2551}
irb(main):008:0>
Thanks for your help in advance.
--
Posted via
http://www.ruby-...
.
2 Answers
Quiroz, Hector
10/5/2007 2:18:00 PM
0
Hector Quiroz wrote:
> From within irb, I'm creating a hash and populating it with the
> following data.
>
> irb(main):007:0> {:QHector => 1967, :WKelly => 2551, :ECron => 0220,
> :VLaura => 4003, :LWalter => 1188}
>
>
>
> Why is the value for the ':ECron' coming back as 144 instead of 0220?
>
> => {:ECron=>144, :VLaura=>4003, :LWalter=>1188, :QHector=>1967,
> :WKelly=>2551}
> irb(main):008:0>
>
>
>
> Thanks for your help in advance.
Oops, the number is being interpreted by ruby as an Octal! Duh.
hq
--
Posted via
http://www.ruby-...
.
Dejan Dimic
10/5/2007 2:26:00 PM
0
On Oct 5, 4:16 pm, Hector Quiroz <hqui...@enh.org> wrote:
> From within irb, I'm creating a hash and populating it with the
> following data.
>
> irb(main):007:0> {:QHector => 1967, :WKelly => 2551, :ECron => 0220,
> :VLaura => 4003, :LWalter => 1188}
>
> Why is the value for the ':ECron' coming back as 144 instead of 0220?
>
> => {:ECron=>144, :VLaura=>4003, :LWalter=>1188, :QHector=>1967,
> :WKelly=>2551}
> irb(main):008:0>
>
> Thanks for your help in advance.
> --
> Posted via
http://www.ruby-...
.
I think this could help :-)
http://blog.wordaligned.org/articles/2006/08/12/octa...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Hash assignment (what's happening?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password