Working not in that way that we want


#1

In last line I write following
puts first_n_primes(-1)

than

puts first_n_primes(1.5)

with this parametr I get the answer
but
puts first_n_primes(a) and puts first_n_primes(‘a’ )
I receive no answer only infinite loop
this means that n.is_a? Integer
working not in that way that we want
I puts in lines 9, 10
following

prime_array ||= []
puts prime_array
with
puts first_n_primes(1)

in last line I get [] in the screen and infinite loop later So - infinite loop - somewhere here
prime = Prime.new
for num in (1…n)
prime_array.push(prime.next)
end
return prime_array


#2

I think module ‘prime’ and ‘mathn’ doesn’t connect with this project. So program for infinity looking for this labrary


#3

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