In ruby, underscore can be inserted into integer literals as thousands separator.
For example:
1_000 will be interpreted as 1000
1_000 + 1_000 will equal 2000
1_000_000_000 will be interpreted as 1 billion
the same technique works for float number as well
For example:
1_000.1 will be interpreted as 1000.1
J
Saturday, September 20, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment