integers with preceding zero don't return as expected?

P

Phillip Gawlowski

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Roger Pack wrote:
| 09:02:40 ~ $ irb
|>> 07023
| => 3603
|
|
| Thoughts? Huh?
| -R

Implicit conversion of an octal number to a decimal, looks like.

07023 octal is 3603 decimal.

A leading 0 usually signifies the use of octal, instead of decimal
numbers, so Ruby does the right thing, just not in the way expected.

- --
Phillip Gawlowski
Twitter: twitter.com/cynicalryan
Blog: http://justarubyist.blogspot.com

~ - You know you've been hacking too long when...
...you "woke up" this morning and thought, "I'll checkpoint here, snooze
a bit more and then revert to checkpoint." A while later you go up
another consciousness notch and realize that you hadn't checkpointed
successfully - "Oh, of course. I didn't have the keyboard."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgjG9cACgkQbtAgaoJTgL9gcwCfRzPMYBHE1OVCJ5h+Ti6oq2iI
ci8An3KmX/NO/ys8e9eulNHUEz9eek+J
=IMZQ
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,204
Messages
2,571,065
Members
47,672
Latest member
svaraho

Latest Threads

Top