Vidyalelo
Ruby Programming · Q21

Basic Syntax in Ruby

Programming · Ruby Programming · question 21

Q21

What is the correct syntax for creating a hash in Ruby?

A.
{"key1": "value1", "key2": "value2"}
Answer
B.
hash = {}
C.
hash.add("key", "value")
D.
Hash.new("key", "value")

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board