What is the correct syntax to check something like this?
if A IN (:B, :C ) {
do something
}
I get syntax error but what is the proper way to do this in Ruby?
SyntaxError: unexpected ',', expecting ')'
What is the correct syntax to check something like this?
if A IN (:B, :C ) {
do something
}
I get syntax error but what is the proper way to do this in Ruby?
SyntaxError: unexpected ',', expecting ')'
Your syntax is not valid ruby code. To check if an item is in a collection, use Enumerable#.include?
if [:B, :C].include?(:A)
# do something
end