Ruby Loop question


#1

What is the function of 'n' int first_n_primes?
For example at the end is the statement 'first_n_prmes(n)'. the 'n' can be anything except '0' or negative and tie program will work but it is based on the n.times {prime_array.push(prime.next)}.
If I put 25.times {prime_array.push(prime.next)} and first_n_primes(5) I will get 25 numbers.
If I leave it blank or put 'n' I will get nil. If I don't have it I get an error
It seems redundant and unnecessary.
Just curious..
Thanx


#2

Hi @codepro49963,

Could you please share the whole code you have? Thanks! :smiley: