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 -

java - More than one row with the given identifier was found: 1, for class: com.model.Diagnosis -