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

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -