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.

Actually, the question may be better asked as: “at what point does Ruby work out that something is a variable?” The problem arises because the simple expression “a\ could be either a variable

0
Posted

Actually, the question may be better asked as: “at what point does Ruby work out that something is a variable?” The problem arises because the simple expression “a\ could be either a variable

0

or a call to a method with no parameters. To decide which is the case, Ruby looks for assignment statements. If at some point in the source prior to the use of “a” it sees it being assigned to, it decides to parse “a” as a variable, otherwise it treats it as a method.

Related Questions

What is your question?

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

Experts123