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

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

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