> For the complete documentation index, see [llms.txt](https://200ok.gitbook.io/200ok-documents/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://200ok.gitbook.io/200ok-documents/user-manual/built-in-functions/logical/if.md).

# if

if() function is the Standard function available in 200OK.

**Description** : The if function evaluates a logical test and returns one value if the test is true, and another if it is false.

**Syntax** : fx\_if(logical\_test, value\_if\_true, value\_if\_false)

**Example** : fx\_if(2, 3, <) returns 2 as the response, and fx\_if(2, 3, >) returns 3 as the response.

Here we go with simple scenario using the above function.

**Scenario** : In a pricing strategy application, a retailer adjusts product prices based on competitor prices. They utilize a function to determine the final price for each product based on competitor pricing. If the competitor price is lower, the retailer matches it; otherwise, they set their own price.

**Request Side** :&#x20;

<figure><img src="https://lh7-us.googleusercontent.com/GsyRQ9mwLtvjGOwIwZA0GRnlwz8ctPSMVIkHfuBjS6yfkO4DSS4W-a1gYf26JRtP7-NloSAbAM5eAgmXJK1rek_hwfhzRLrRaAHSHOmBddz7NldrtrBNMX8rNtnCI1AWVNTvYymJDO0L_sqb-j_Gh9Y" alt=""><figcaption></figcaption></figure>

**Response Side** :&#x20;

<figure><img src="https://lh7-us.googleusercontent.com/BMewEBzj1cxYVz7woJMf_fmS1DJMExXkotgJ2A9PpjMMVP4TKtUOrtnKSQw6FoK311Gg1Q78a75CUYq1nZlecs056k3fjinfesPIh5UB1Q7yVLDqFXahlqOW-1Oe2qIn8nHk5fyIc8GLkZ4xfq6o1Yw" alt=""><figcaption></figcaption></figure>

<br>

<figure><img src="https://lh7-us.googleusercontent.com/8o1TmJpyTMtr9rvgZueaBkZRcTPb59AE9kzv9va0YT3vZQ-XskWIA1m-abixEs-14_v_P5p1qpmuM60qyslGc10h6SUqcz9AOB3bgF4sWr5wWwcjQ_UClOvEJRdKon2ELsTCOchVyc-k9eOMf8SwUXk" alt=""><figcaption></figcaption></figure>
