The Or and if-else-if logic

Hi there

I’m wondering… How does the Or logic work?


if (1 or 2 or 3 or 4 or 5) {
  doSomething()
}

How does it run the test? I mean if 1 is true, will it jump the test for 2, 3, 4 and 5 and carry out whatever inside the curly brackets?

What about this?


if (1) {
  doSomething()
} else if (2) {
  doSomething()
} else if (3) {
  doSomething()
} else if (4) {
  doSomething()
} else if (5) {
  doSomething()
}

So if 1 is true, it won’t carry out the test for 2, 3, 4 and 5. Is my understanding correct?

Thanks in advance.