What is the correct syntax for creating a hash in Ruby?
A. {"key1": "value1", "key2": "value2"}
B. hash = {}
C. hash.add("key", "value")
D. Hash.new("key", "value")
Answer: Option A
A. {"key1": "value1", "key2": "value2"}
B. hash = {}
C. hash.add("key", "value")
D. Hash.new("key", "value")
Answer: Option A
What does the 'puts' method do in Ruby?
A. Prints to console
B. Converts to string
C. Finds the length
D. Reads input from user
Join The Discussion