> For the complete documentation index, see [llms.txt](https://doc.sysdevmobile.com/kalipso/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.sysdevmobile.com/kalipso/documentation/actions/group-code-flow/if...else...elseif...endif.md).

# IF...ELSE...ELSEIF...ENDIF

The if-then construct (sometimes called if-then-else) is common across many programming languages. Although the syntax varies quite a bit from language to language, the basic structure looks like.

Action available for the following operating systems:

<figure><img src="https://1614058754-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJ5vDGuBZwhJDeu5Rq7Wt%2Fuploads%2Fgit-blob-7a7ab3f3fc74afcaab1e0810f419316203cc49e1%2F01_Supported_OS.png?alt=media" alt="OS Supported: Android, iOS, Win, Win32"><figcaption></figcaption></figure>

### Parameters

* **Condition** *\<unquoted string> -* This parameter indicates a condition or conditions that is evaluated.

### Usage

Consider the following variables and respecting values:

| **Variable** | **Value**    |
| ------------ | ------------ |
| VAR(0)       | 1            |
| VAR(1)       | 2            |
| VAR(2)       | 10           |
| VAR(3)       | <p>0<br></p> |
| VAR(4)       | ""           |

#### **Example 1**

```
If(VAR(0)=1 AND VAR(2)=2)
Set Value(VAR(0),Numeric, 4)
Else
Set Value(VAR(0),Numeric, 40)
End If
```

*Result:*

| **Variable** | Value |
| ------------ | ----- |
| VAR(0)       | 40    |
| VAR(1)       | 2     |
| VAR(2)       | 10    |

#### **Example 2**

```
If(VAR(0) <> 1)
Set Value(VAR(0),Numeric, 4)
Else If(VAR(1) > 1 AND VAR(2) < 50)
Set Value(VAR(0),Numeric, 40)
End If	
```

*Result:*

| **Variable** | Value |
| ------------ | ----- |
| VAR(0)       | 40    |
| VAR(1)       | 2     |
| VAR(2)       | 10    |

#### **Example 3**

```
If(VAR(3)= VAR(4))
```

*Comparison made is **0** = **""** and the result **is ""***\
\
**Return**: True

#### **Example 4**

```
If(VAR(4)= VAR(3))
```

*Comparison made is **""** = **0** and the result is **"0"***\
\
**Return:** False

{% hint style="info" %}
Each *If* action must have a corresponding *End if* action.
{% endhint %}

{% hint style="info" %}
When the operands are of different types (numeric, string), the second operand is converted to the type of the first (See **Example 3** and **Example 4**).
{% endhint %}
