Hash Syntax Confusion
Learn about two types of Ruby syntaxes for defining a Hash object.
You can skip the following and jump right to the next lesson if you’re already familiar with this topic, or you can keep reading if you’re curious. If you’re unfamiliar with the word syntax, you’ll benefit from reading this.
Many online resources use another alternative syntax to define hashes.
Note: The term syntax, in programming, refers to ways to use punctuation and other symbols to create objects (amongst other things).
The fact that we can use square brackets ([]
) and commas (,
) to define arrays, ...