Is the following statement possible with Rails/Ruby? If so, how :)
IF XXX Equals At Least One (Var1, Var2, Var3)
Is the following statement possible with Rails/Ruby? If so, how :)
IF XXX Equals At Least One (Var1, Var2, Var3)
if [a, b, c].find_index(XXX)
Sounds simple enough. And there's nothing wrong with classical way too:
if XXX == a || XXX == b || XXX == c
Try this:
if [v1, v2, v3].any?{|v| v=="XXX"}
p "Success"
end
OR
if [v1, v2, v3].include?("XXX")
p "Success"
end