# conditional

## Description

Checks whether the condition passed is met and executes the callback functions accordingly.

## Input / Parameter

| Name      | Description                                     | Input Type  | Default | Options | Required |
| --------- | ----------------------------------------------- | ----------- | ------- | ------- | -------- |
| condition | The condition to be checked against.            | String/Text | -       | -       | Yes      |
| yesValue  | The output value if condition is 'true'.        | Any         | -       | -       | No       |
| noValue   | The output value if condition is 'false.        | Any         | -       | -       | No       |
| extra     | Extra parameters stored and passed to callback. | Any         | -       | -       | No       |

## Output

| Description                          | Output Type |
| ------------------------------------ | ----------- |
| Returns the 'yesValue' or 'noValue'. | Any         |

## Callback

### yesCallback

The function to be executed when the condition passed is 'true'.

### noCallback

The function to be executed when the condition passed is 'false'.

## Video

Coming Soon.

## Example

The user wants to prove that the value `13` is greater than the value `1` and see the result in the console.

### Step

| No. | Description                                                                                                                                                                                                                                                                                                                                                                                                                       |                                                                                                                                                                                                                          |
| --- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 1.  | ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-dc311eb255a6ae3008a74350e4376579b865e348%2Fconditional-step-1.png?alt=media) ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-ff30d9ff210cbddfded8cc655cba9645991716e9%2Fconditional-step-2.png?alt=media) | Drag a button to a page in the mobile designer. Select the event `click` for the button and drag the `conditional` function to the event flow. Select the `function` parameter input type for the `condition` parameter. |
| 2.  | ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-e229042ea8cfe9dfb5f4f606d59aa2ce23907f87%2Fconditional-step-3.png?alt=media)                                                                                                                                                                                                                  | Drag the function `greater` to the subflow.                                                                                                                                                                              |
| 3.  | ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-18bc5c0c26ae4e03ae3bdee299a042e4124ee822%2Fconditional-step-4.png?alt=media)                                                                                                                                                                                                                  | Fill in the inputs of the `greater` function.                                                                                                                                                                            |
| 4.  | ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-5aabc48d4d7d16feaaa97b54c72fc411fc4ec510%2Fconditional-step-5.png?alt=media)                                                                                                                                                                                                                  | Drag the function `console` to the `yesCallback` and `noCallback` nodes of the `conditional` function.                                                                                                                   |
| 5.  | ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-ede873a62801904908bf7121db73ba6342c889a9%2Fconditional-step-6.png?alt=media) ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-ff00f4373753f2c71ba8a71170e1ee1b7fffb02a%2Fconditional-step-7.png?alt=media) | The `console` function in `yesCallback` should return 'greater' while the `console` function in `noCallback` should return 'not greater'.                                                                                |

### Result

When the button is pressed, the console will print 'greater'.

## Links
