# Multi-pattern IF, ELSE IF, ELSE control

**URL:** <https://forum.robotframework.org/t/multi-pattern-if-else-if-else-control/6780>\
**Category:** Robot Framework\
**Created:** [5 February 2024 21:04 UTC](https://forum.robotframework.org/t/multi-pattern-if-else-if-else-control/6780 "2024-02-05T21:04:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CSUThornton](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/csuthornton/32/3270_2.png) [@CSUThornton](https://forum.robotframework.org/u/CSUThornton)\
**Post date:** [5 February 2024 21:04 UTC](https://forum.robotframework.org/t/multi-pattern-if-else-if-else-control/6780/1 "2024-02-05T21:04:24Z")

</div>

Hello Robot community,

reference: [Conditional IF / ELSE IF / ELSE execution in Robot Framework | Robocorp documentation](https://robocorp.com/docs/languages-and-frameworks/robot-framework/conditional-execution)

I’m having difficulty with what I think is a basic programming concept. I’m trying to write if and else if control loops with multiple conditions. For example,

IF “abc” in ${HOST} or “def” in ${HOST} or “hij” in ${HOST}  
. . . do something  
ELSE IF IF “tuv” in ${HOST} or “xyz” in ${HOST}  
. . . do something else  
ELSE  
. . . do nothing and end

when I attempt this type of control loop, I get an error about a keyword not being next. I have two questions:

1 - Is this type of multi-condition If, else if looping possible in Robot?  
2 - If it is, is there a better document which provides better instruction on what I might be doing wrong?

Confused!

---

<div class="post-metadata">

**Author:** ![\_daryl](https://avatars.discourse-cdn.com/v4/letter/_/45deac/32.png) [@\_daryl](https://forum.robotframework.org/u/_daryl)\
**Post date:** [6 February 2024 09:14 UTC](https://forum.robotframework.org/t/multi-pattern-if-else-if-else-control/6780/2 "2024-02-06T09:14:59Z")

</div>

Hi

That documentation ref you have been using is on point.

The snippet you shared holds two `IF IF` on the `ELSE IF` and you also have no `END` after the end of the block  
 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/c/c8771b3cbc06af8a587f8bda9eb1c9fe746457a0.png)

The `in` is to check if `in` an object, but as the format is not correct and will be tripping over here first it has likely not to have got that point yet for any errors if any, if you are unsure of the type, you can debug with:

```
${type}= Evaluate type($variable)
${type}= Evaluate type($variable). __name__

```

It’s probably worth getting the format correct for the IF first; you do mention “looping” though whereas the snippet shared and a IF / ELSE IF / ELSE are conditionally checks not looping.

I hope that helps
