Hi guys, I am coming to you because for my project, I need a function that can take as parameter a var, that can be a string OR an array of string.
But when I run this function, the compiler complain that the each method don’t exist for a string.
How can I do this ?
My example:
def testy(var : String | Array(String))
if typeof(var) == String
puts var
else
var.each do |entry|
puts entry
end
end
end
testy("5")