Number Node
Overview
The Number Node is used to output a constant number value or convert an input value into a number. It can also be configured to round the number to a certain number of decimal places.
- Inputs
- Outputs
- Editor Settings
Inputs
Title | Data Type | Description | Default Value | Notes |
---|---|---|---|---|
Input | any | The value to be converted into a number. | (empty) | This input is only available if Use Value Input is enabled. The input will be coerced to a number. |
Outputs
Title | Data Type | Description | Notes |
---|---|---|---|
Value | number | The output number value. This can either be a constant value or a converted input value. | None |
Editor Settings
Setting | Description | Default Value | Use Input Toggle | Input Data Type |
---|---|---|---|---|
Value | The constant number value to be outputted. | 0 | Yes | number |
Round | If enabled, the output number will be rounded to the specified decimal places. | false | No | N/A |
Round To | The number of decimal places to round the output number to. | 0 | No | N/A |
Example 1: Output a constant number
- Create a Number Node.
- Set the
Value
to123.456
. - Run the graph. The
Value
output of the Number Node should be123.456
.
Example 2: Convert a string to a number
- Create a Text Node and set the text to
123.456
. - Create a Number Node and enable the
Use Value Input
setting. - Connect the Text Node to the
Input
of the Number Node. - Run the graph. The
Value
output of the Number Node should be123.456
.
Example 3: Round a number
- Create a Number Node.
- Set the
Value
to123.456
. - Enable the
Round
setting and setRound To
to2
. - Run the graph. The
Value
output of the Number Node should be123.46
.
Error Handling
The Number Node will not error under normal circumstances. If the Input
value cannot be converted to a number, it will default to the Value
setting.
FAQ
Q: Can I use the Number Node to convert a boolean to a number?
A: Yes, you can use the Number Node to convert a boolean to a number. A true
value will be converted to 1
and a false
value will be converted to 0
.
Q: What happens if I connect a non-numeric value to the Input
of the Number Node?
A: The Number Node will attempt to convert the input value to a number. If the conversion is not possible, the node will default to the Value
setting.
Q: Can I use the Number Node to round a number to an integer?
A: Yes, you can use the Number Node to round a number to an integer by enabling the Round
setting and setting Round To
to 0
.