Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion student.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ def initialize(first_name, last_name, grade)
@grade = grade
end

def junior?
grade == 11
end

def senior?
grade == 12
end
Expand All @@ -16,6 +20,10 @@ def to_s
end
end

def juniors(students)
students.select { |student| student.junior? }
end

def seniors(students)
students.select { |student| student.senior? }
end
Expand All @@ -25,6 +33,16 @@ def seniors(students)
jack = Student.new("Jack", "Gong", 11)
all_students = [fred, sarah, jack]

puts "Seniors"

seniors(all_students).each do |student|
puts student
puts " * " + student.to_s
end

puts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is about the only thing I can find to comment on... If you want an empty line, it's better to use the \n designation.

so, you could do puts "\nJuniors" and it'll have a line there

or really, even the following makes it look like you meant to have the empty line. Without might imply you forgot it was there.

puts ""

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback because I was asking myself these very questions...
fixed now.

On Mon, Nov 4, 2013 at 12:55 PM, Jesse Wolgamott
[email protected]:

In student.rb:

seniors(all_students).each do |student|

  • puts student
  • puts " * " + student.to_s
    +end

+puts

This is about the only thing I can find to comment on... If you want an
empty line, it's better to use the \n designation.

so, you could do puts "\nJuniors" and it'll have a line there

or really, even the following makes it look like you meant to have the
empty line. Without might imply you forgot it was there.

puts ""


Reply to this email directly or view it on GitHubhttps://github.com//pull/7/files#r7409313
.


puts "Juniors"

juniors(all_students).each do |student|
puts " * " + student.to_s
end