Step 1: Identify correct hash syntax for storing key-value pairs
user = { name: 'Eve', age: 28, email: 'eve@example.com' } uses a hash with symbol keys and values inside curly braces, which is clear and easy to update.
Step 2: Evaluate other options for correctness and clarity
user = [ 'name' => 'Eve', 'age' => 28, 'email' => 'eve@example.com' ] uses array syntax incorrectly, C is invalid syntax, and D uses parentheses which is not valid for hashes.
Final Answer:
user = { name: 'Eve', age: 28, email: 'eve@example.com' } -> Option A
Quick Check:
Curly braces with symbol keys = best practice [OK]
Quick Trick:Use curly braces and symbol keys for clear, update-friendly hashes [OK]
Common Mistakes:
Using arrays instead of hashes
Incorrect syntax with parentheses
Mixing key-value pairs without proper separators
Master "Hashes" in Ruby
9 interactive learning modes - each teaches the same concept differently