1

My question may not make much sense, so let me reiterate. Let's say I have code that looks like so:

int value = 4;
if (value == 4 || value == 8 || value == 12) {
    doSomething();
}

Would it be possible to compare 4, 8, and 12 to value without rewriting "value ==", such as:

if (value == (4 || 8 || 12)) {
    doSomething();
}
Kontorted
  • 226
  • 1
  • 13

0 Answers0