forked from Bayonnaise/student-directory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproof_read_Eddie.rb
38 lines (34 loc) · 902 Bytes
/
proof_read_Eddie.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
32
33
34
35
36
37
38
def print_header
put "The students of my cohort at Makers Academy'
puts ``-------------``
end
def print_students
student.each do |student|
puts "#[student{:name}] (#[student{:cohort}] cohort)"
end
end
def print_footer_names
prints "Overall, we have #{names.length} great students"
end
def input_students
puts "Please enter the names of the students"
puts "To finish, just hit return twice"
% create an empty array
students = {}
% get the first name
name = gets.chomp
% while the name is not empty, repeat this code
while name.!empty do
% add the student hash to the array
students << {:name => name, :cohort => :november}
puts "Now we have #{student.length} students"
% get another name from the user
name = get.chomp
end
% return the array of students
students
end
students = input_students
print_header
print students
print_footer_names