→ Nice numbers with underscores _ in Ruby → → →

Big numbers in code are not the most readable thing. There's a simple way to improve it. Just use underscores! What is 10000000? It's the same as 10_000_000! As simple as that! Works also with floats. And yes, you could argue that it's the same as 10**7... Let's just quickly see irb output:

>> 10_000_000
=> 10000000
>> 7_568.123_456
=> 7568.123456

Created on 11 May 2009