Use each method from Prime class : Prime Numbers « Number « Ruby






Use each method from Prime class



#!/usr/bin/env ruby

require 'mathn'

list_primes = Prime.new

list_primes.each { |prime| print prime, " "; break unless prime < 90 }

 








Related examples in the same category

1.Prime Numbers
2.Use Prime to generate prime numbers
3.Generates 25 prime numbers from 2 to 97
4.Generating Prime Numbers with succ
5.Pass code block into each