forked from appdev-projects/ruby-project-hash-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.rb
31 lines (28 loc) · 852 Bytes
/
list.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Given this list of people, print only names of
# people who are at least 16.
#
# Yes, you could just look at it with your eyes
# and print their names, but imagine that you
# couldn't because there are a million items in the list.
#
# Use the variable, loops, and conditionals instead.
#
# Print each name on a new line, like:
#
# James
# Yolanda
# etc.
list_of_people = [
{ :name => "James", :age => 16 },
{ :name => "Lee", :age => 12 },
{ :name => "Yolanda", :age => 26 },
{ :name => "Mel", :age => 15 },
{ :name => "Red", :age => 38 },
{ :name => "Fatimah", :age => 31 },
{ :name => "Carl", :age => 9 },
]
# ~~~~~ Specs (make it do these things) ~~~~~
#
# list.rb prints 'James', 'Yolanda', 'Red', and 'Fatimah' using variables, loops, if statements, and Hash methods'
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~