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
Post a Comment