Accept number of inputs based on a number given at runtime in ruby -


accept integer n based on n, accept n inputs ex: @ runtime n = 2 2 inputs of type string should accepted

ex: @ runtime n = 3 3 inputs of type string should accepted

array = [] n.times {array << gets.chomp} 

Comments

Popular posts from this blog

PHP Error "Undefined index" -

C# List<> to xml -

php - How to only save new tweets/instagram photos to database? -