What does it mean: mean in rails before the variable name?

For example, a symbol :- I am trying to determine what it means :and how it differs, for example, from @, as well as from any symbol in general.

If there is a guide that would be really helpful!

+5
source share
4 answers

This is the symbol that is the construction of the Ruby language.

The characters are like lines, but this blog post explains the details.

@means an instance variable in a class: it is basically a variable that is shared among all methods of an instance of the class. It has nothing to do with :.

+10

: , .

@ - - , , .

variable_name , , .

, - this

+2

@- ivar : ( COSTANT C, - )

+1

All Articles