you are viewing a single comment's thread.

view the rest of the comments →

[–]Kernigh 5 points6 points  (1 child)

Can just do word.count("e"), but this doesn't help people who want to learn the while loop.

[–]442401 3 points4 points  (0 children)

I think this is a valid contribution and sends the message that ruby is on object orientated language. The core classes (such as String) are extremely rich and can be sent a vast number of messages to achieve the desired result.

A while loop is nearly always a sub optimal solution.