forked from tdyer/ruby-hashes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstructor_notes.txt
More file actions
25 lines (19 loc) · 907 Bytes
/
instructor_notes.txt
File metadata and controls
25 lines (19 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Ruby Hashes
The Ruby Hash class implements a "data structure" that provides a
collection of key-value pairs. The keys are used to 'index', or find,
the value associated with the value.
### Demo
Create a file _simple_hash.rb_.
Finished version is _simple_hash_done.rb_
### Lab
Write a program in the file _squares_hash.rb_ that:
* Prompts the user for a minimum and maximum number.
* Generates a Hash that has key-value pairs, or entries, where.
* Each key in a pair is a integer between the min and max entered.
* Each value in the pair is the square of key in that pair. But this value should be instance of String.
* Show/print the hash generated.
### Lab
Modify _choose_state.rb_ to prompt and get a New England state code from the user. Then print out the name of the state.
### Demo
Create a file _relative_contacts.rb_.
Finished version is _relative_contacts_done.rb_