Search⌘ K
AI Features

Exercise 1: Create a Hash

Understand how to create and manipulate hashes in Ruby by pairing keys with values. This lesson helps you practice the basic syntax and methods to build and return a hash, strengthening your grasp of essential Ruby built-in classes.

We'll cover the following...

Problem statement

Create and return a hash with the values “one”, “two”, and “three” stored against the keys “uno”, “dos”, and “tres”, respectively.

Example

Expected Output: { "uno" => "one", "dos" => "two", "tres" => "three" }

Try it yourself

Ruby
def create_hash()
result = {}
# Start your code here
return result
end