I\'ve got the following logic in my code:
if !@players.include?(p.name)
...
end
@players
is an array. Is there a method so
Using unless
is fine for statements with single include?
clauses but, for example, when you need to check the inclusion of something in one Array
but not in another, the use of include?
with exclude?
is much friendlier.
if @players.include? && @spectators.exclude? do
....
end
But as dizzy42 says above, the use of exclude?
requires ActiveSupport