Evaluate Node
Overview
The Evaluate Node performs a mathematical operation on the input values and outputs the result. It supports a variety of operations including addition, subtraction, multiplication, division, exponentiation, modulus, absolute value, and negation.
- Inputs
- Outputs
- Editor Settings
Inputs
Title | Data Type | Description | Default Value | Notes |
---|---|---|---|---|
A | number | The first operand for the operation. | (Required) | The input will be coerced into a number if it is not a number. |
B | number | The second operand for the operation. | (Required for binary operators) | The input will be coerced into a number if it is not a number. |
Outputs
Title | Data Type | Description | Notes |
---|---|---|---|
Output | number | The result of the operation. |
Editor Settings
Setting | Description | Default Value | Use Input Toggle | Input Data Type |
---|---|---|---|---|
Operation | The operation to perform on the input values. Options include + , - , * , / , ^ , % , abs , and negate . | + | Yes | string |
Example 1: Performing a simple addition
- Create an Evaluate Node and set the
Operation
to+
. - Create two Number nodes, set their values to
2
and3
respectively. - Connect the Number nodes to the
A
andB
inputs of the Evaluate Node. - Run the graph. The output of the Evaluate Node should be
5
.
Error Handling
If the operation fails (for example, if you try to divide by zero), the Evaluate node will error.
FAQ
Q: What if I want to perform a different operation based on the input?
A: You can use the Operation
input port to dynamically change the operation based on the input. The input will be coerced into a string and must match one of the supported operations.