I am here to share a small tip that I just come to know about Ruby. A simple question. How many zeros are there integer written below?
Difficult to count right? In normal day to day practice, we generally use a comma to separate the digits, for example in US standard we use a comma every 3 digits. So number written above can be re-written as:
Now the same thing can be done with long integers in Ruby using an underscore, something like this:
which is actually same as writing 100000000000, but using underscore makes things easier to read;)
I hope you will find this technique somewhere useful ;)