Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Can an identifier beginning with a capital letter be a method name?

0
Posted

Can an identifier beginning with a capital letter be a method name?

0

Yes, you can, but we don’t do it lightly! If Ruby sees a capitalized name followed by a space, it will probably (depending on the context) assume it’s a constant, not a method name. So, if you use capitalized method names, always remember to put parameter lists in parentheses, and always put the parentheses next to the method name with no intervening spaces.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123