Prime.new and Prime.next obsolete in Ruby >2.2


#1



https://www.codecademy.com/courses/ruby-beginner-en-Zjd2y/0/5?curriculum_id=5059f8619189a5000201fbcb


Prime.new and Prime.next obsolete


  prime = Prime.new
  for num in (1..n)
    prime_array.push(prime.next)


#2

Yes, there is a short discussion on SO...

http://stackoverflow.com/questions/22721356/prime-new-is-obsolete-how-to-rewrite-this-code

The version of Ruby in the course track is 1.9.3, if I'm not mistaken. The old code should still work here.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.


1 / 4 - Error: private methodnew’ called for Prime:Class (NoMethodError)