Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Ruby Basics (Retired) Ruby Methods Methods in Ruby

^ is not a valid character Ruby for method name. But ! and ? is valid characters for method name. Why?

In one of the quizzes said as follows. ^ is not a valid character Ruby for method name. But ! and ? is valid characters for method name.
Why?

1 Answer

Ari Misha
Ari Misha
19,323 Points

Hiya there! As a Ruby developer for years now, i think Ruby is the most versatile and flexible language i know. And every symbol has some kinda meaning and best practices to it. Like you may come across seeing the methods ending with ! and ?. There are methods who does stuff to array or original values but dont mutate the original values. So ! represents the methods where original values do get mutated. Whereas ? at the end of some method represents that the same method throws a boolean value. There are many more characters but ^ is an invalid character.

~ Ari

Thank you!