If
Last updated
Last updated
Makes a choice between two values based on a condition. When the condition is true, it returns the first value; otherwise, it returns the second value. This is essential for creating dynamic content or responsive behaviors.
condition
The test that determines which value to use
Yes/No
Yes
a
The value to use when condition is true
Any
Yes
b
The value to use when condition is false
Any
Yes
value
Either value "a" or value "b" depending on the condition
Any
Drag the If node into your graph.
Connect a boolean (true/false) value to the "condition" input.
Connect your "true case" value to the "a" input.
Connect your "false case" value to the "b" input.
Run the graph—your output will be either value "a" or value "b".
You can use any type of values for the inputs, but both "a" and "b" should be compatible types.
Chain multiple If nodes together to create more complex conditional logic.
Switch: For selecting from more than two options based on a value.
AND/OR: For combining multiple conditions.
Responsive Design: Choose different spacing or typography based on screen size.
Theme Switching: Select different colors depending on light/dark mode.
State Management: Display different values based on UI state (hover, pressed, disabled).