# 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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://200ok.gitbook.io/200ok-documents/user-manual/built-in-functions/logical/if.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
