Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
If you are sometimes feeling bored and want to entertain yourself, then rather than aimlessly scrolling in a social media, you can try to learn something new. For example, you can learn something that you have not known that you can do with Ruby: Getting the dates for next Mondays, Tuesdays or any other day of the week.
Here is how you do it:
After you execute it, you will see the list of the dates:
We can replace the part monday with any other name of the days of the week in English and it will work fine.
I know that this may look like something that may not be that much benefit, but maybe, you could use it in a personal script that you have. In a better case, I hope this inspires you to explore more in the documentation of a programming language that you use so that you can learn more hidden gems that can save you a lot of time.
How to quickly get the dates for the first 10 Mondays using Ruby was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.