I have three integer variables like:
c0, c1, c2
I don't have the focus and have a difficult time determining all the possible cases of their equality:
if c1 == c0 && c2 == c0 {
// ...
} else if c1 != c0 && c2 != c0 && c1 != c2 {
// ...
} else if c1 != c0 && c2 != c0 && c1 == c2 {
// ...
} else if c1 == c0 && c2 != c0 {
// ...
} else if ... ?
Can anybody help?
They are either all equal (one possibility), or two are equal and one isn't (three possibilities), or none are equal (one possibility). This gives us five unique possibilities in total:
And now use else to account for the last possibility of none of them being equal: