i am currently working on an App that needs to compare three Variables with each other.
Rules for Comparison: The result should only be true if: All three variables are equal OR All three variables are different
My first idea was something like this, but I hope there is a more elegant solution for this:
if (value1 == value2 && value2 == value3) || (value1 != value2 && value2 != value3 && value3 != value1) {
// True
} else {
// False
}
I would be really happy if someone of you can think of a more elegant solution and share it with me. Thanks for your help in advance!
Aucun commentaire:
Enregistrer un commentaire