Use _ for more readable integer literals
Though I think everyone agrees you shouldn't have arbitrary magic strings or numbers in your app, you inevitably will. Here's how you can make them a little more readable.
MY_CONST = 713014359
That's a bit hard to read, let's use some awesome Ruby syntactic sugar.
MY_CONST = 713_014_359
Much better!
>> 713_041_359 == 713041359
=> true
Written by Chad Moran
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Related Tags
#ruby
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#