#How does one use an if statement where this equals "this or that"? Examples ahead...

1 messages · Page 1 of 1 (latest)

copper halo
#

Would this work, for example?

if (var1 == A || B) {...}
//or this?
if (var1 == A || var1 == B)
//or this?
if (var1 == [A,B,C])
snow coralBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

pallid turret
#

the second

#

also

#

??tryitandsee

shut gazelleBOT
copper halo
pallid turret
#

what

copper halo
#

that seems like a long thing

#
if (var1 == A || var1 == B || var1 == C || var1 == D || var1 == E || var1 == F)

Doesn't this look a bit goofy?

pallid turret
#

it does

#

you can also do another thing

#
let array = [A, B, C, D, E, F]
if(array.includes(var1)) console.log('hello! :D')
queen crown
#

hello! :D

pallid turret
#

:D

copper halo
#

amongE

queen crown
#

o.o

pallid turret
copper halo
#

Ah, ok yes, that .includes looks not as goofy

pallid turret
copper halo
#

Thanks, that's what I was looking for