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


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/ruby-beginner-en-Zjd2y/0/5?curriculum_id=5059f8619189a5000201fbcb

<In what way does your code behave incorrectly? Include ALL error messages.>
Prime.new and Prime.next obsolete

```

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

<do not remove the three backticks above>

#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)