# The Or and if-else-if logic

**URL:** <https://forum.kirupa.com/t/the-or-and-if-else-if-logic/293107>\
**Category:** programming\
**Created:** [July 23, 2009, 9:04am UTC](https://forum.kirupa.com/t/the-or-and-if-else-if-logic/293107 "2009-07-23T09:04:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wkt](https://avatars.discourse-cdn.com/v4/letter/w/ed655f/32.png) [@wkt](https://forum.kirupa.com/u/wkt)\
**Post date:** [July 23, 2009, 9:04am UTC](https://forum.kirupa.com/t/the-or-and-if-else-if-logic/293107/1 "2009-07-23T09:04:49Z")

</div>

Hi there

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

```auto

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?

```auto

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.
