jeudi 1 février 2018

GoLang, how to write a multi-line statement if condtion

i want to match bellow "a" value with b,c,d,e,f at once instead of writing multiple times like this.
my values are:
a = 11
b = 22
c = 33
d = 44
e = 55
f = 66
if a != b && a != c && a != d && a != e && a != f{
print text
}
else{
print text
}
is actual working code method i have.

but i want to write like
if a != b or c or d or e or f {print text}
"a" value should be used once in if statement.
is there is any easy method.

Aucun commentaire:

Enregistrer un commentaire