Answer the question
In order to leave comments, you need to log in
Ruby syntax parsing?
Good afternoon.
I'm confused with the syntax, help me figure it out!
In rails I often see the syntax:
name1 - This is the function to which the parameter is passed
name2 - the hash passed to the function name1
name3 is the character that is in the hash.
Is it so? Do I understand correctly?
Explain colon declarations - I'm confused about them. name1 name2: :name3
Answer the question
In order to leave comments, you need to log in
name1 - this is the name of the method, everything is correct, but its parameter is hash
name2: - key
:name3 - value
Calling is equivalent to Symbolname1({name2: :name3})
begins with a colon
If you use the old hash syntax, it might be clearername1({:name2 => :name3})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question