Help please


#1



w = []

def add_to_array(arg)
puts"Type in something to add in this array."
name = gets.chomp
if name.is_a? integer?
name = name.to_i
arg.push(name)
puts"added number."
else
arg.push(name)
puts"Added string"
end
end

add_to_array(w)

the goal is to ■■■ to this array whether its a string or number i think i messed up the part with the interger? and is_a?

Replace this line with your code.


#2

Are you doing the lesson about writing a lambda and passing it to a method?


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.