How to quickly get the dates for the first 10 Mondays using Ruby

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.

read original article here