a = [2, 3, 5, 8, 9, 12] b = [3, 5, 6, 9, 11] @c = a - b Ans: [2, 6, 12]
n = 3 m = 8 @e = "%d %d %d\n" % [n <=> m, m <=> n, m <=> m] s = "orange" t = "apple" @f = "%d %d %d\n" % [s <=> t, t <=> s, t <=> t] Ans: -1 1 0 1 -1 0
<p>User has <%= pluralize(@n, "photo") %>.</p>Set the value of @n in the controller.
# in the model file app/models/course.rb: has_many :enrollments has_many :students, through: enrollments # in the model file app/models/student.rb: has_many :enrollments has_many :courses, through: enrollments
def <=>(other_course) self.course_num <=> other_course.course_num end
<% @student.unenrolled_courses.each do |course| %>with
<% @student.unenrolled_courses.sort.each do |course| %>