# Conditional statements

**JM-**'s Conditional statements, just like [Data types](https://jmdash.gitbook.io/jmdash-docs/jmbasics/syntax101/data-types) are similar to **C**/**C++**, except for [her](https://jmdash.gitbook.io/jmdash-docs/jmbasics/syntax101), that always needs to stay [edgy af](https://www.urbandictionary.com/define.php?term=edgy).

**JM-** also supports [mathematics' logical conditions](https://jmdash.gitbook.io/jmdash-docs/jmbasics/syntax101/mathematics-logical-conditions).

## Syntax & Examples

**Conditional statements'** syntax;\
\&#xNAN;**\*Note**: Only the last conditional statement ends with a semicolon\
**\*Note**: You can ignore whitespaces, they got added for readability

<pre class="language-c" data-line-numbers><code class="lang-c"><strong>// If statement syntax example - Extracted from the, PIDD
</strong><strong>if (&#x3C;condition>) : {
</strong>    // Code here
};
</code></pre>

<pre class="language-c" data-line-numbers><code class="lang-c">// Else if statement syntax example - Extracted from the, PIDD
if (&#x3C;condition>) : {
<strong>    // Code here
</strong>}
else if (&#x3C;condition>) : {
    // Other code here
};
</code></pre>

{% code lineNumbers="true" %}

```c
// Else statement syntax example - Extracted from the, PIDD
if (<condition>) : {
    // Code here
}
else : {
    // Other code here
};
```

{% endcode %}

{% code lineNumbers="true" %}

```c
// Switch statement syntax example - Extracted from the, PIDD
switch.<variableDataType>(<variableName>) {
    <caseNum>*<condition>:
        // Code here
        sgo; // `switch.go.on;` Tells the switch to check other cases
    <caseNum>*<condition>:
        // Other code here
        sgo;
};
```

{% endcode %}

**\*Sidenote:** A `switch{}` function must have a minimum of 2 cases.\
-> The second one can also be an empty case with an `sgo;` only.
