I'm trying to trigger a condition if a variable meets one of two values. I'm aware I can express this as:
if x == 5 || x == 6
execute code...
end
But I was wondering if there was something a bit more elegant in case x
has a long name. Something like:
if x == {5, 6}
execute code...
end
Anyone have any ideas?
Aucun commentaire:
Enregistrer un commentaire