If Node
Overview
Takes in a condition and a value. If the condition is truthy, the value is passed through the True port, and the False port is not ran. If the condition is falsy, the value is passed through the False port, and the True port is not ran.

- Inputs
- Outputs
- Editor Settings
Inputs
| Title | Data Type | Description | Required | |
|---|---|---|---|---|
| If | conditional | The condition you would like to check. | True | |
| Value | any | The value passed through either True or False ports. | True |
Outputs
| Title | Data Type | Description |
|---|---|---|
| True | type of Value | Returns the Value if the condition is True. |
| False | type of Value | Returns the Value if the condition is False. |
Editor Settings
This node does not have any specific settings.
Example 1: Simple string comparison
- Let's say we're trying to build a simple string comparison. The code for which in Typscript would look something like below:
if('Hello, World!' === 'Not Hello, World!')
- Similarly in Rivet we can make the following graph to perform a similar comparison.

- Create the following nodes in your graph:
- An
Ifnode - A
Comparenode - Two
Input Textnodes: System Text and Input Text - Two
Graph Outputnodes: True Output and False Output
- An
- Connect the following nodes:
- System Text
OutputtoAof the Compare node andValueof the If node - Input Text
OutputtoBof the Compare node- Make sure the Compare condition is set at
==
- Make sure the Compare condition is set at
- If Node
Trueto True Output - If Node
Falseto False Output
- System Text
- You are ready to run the graph
- Results: You'll see that based on the Input Text, and the comparison we've supplied to the If node, the graph output execution changes. If the If condition supplied to the node is true, the true port receives the value but if its false, the false port receives the values.