7. Nice Work


I didn't actually understand what $VERBOSE = nil and prime = Prime.instance are actually doing. Could someone explain?


It looks like this might be an old post, but just in case you still need an explanation (or someone else reading this later does), here goes.

I'm not sure what exactly the $VERBOSE = nil does, but the sidebar says it allows us to use the old Ruby 1.8 syntax without getting an error from the Ruby 1.9 compiler.

The Prime is a special object in Ruby; it is an array of prime numbers. So when you write prime = Prime.instance, you are assigning the variable prime a copy of the Prime object, which means your prime will be an array of prime numbers.
Here's a link to the documentation for the Prime, which I found useful: