> ## Documentation Index
> Fetch the complete documentation index at: https://docs.odella.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Number Block

> Output a constant number value or convert an input value into a number

## Overview

The Number Block 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 specified number of decimal places.

<Frame>
  <img src="https://mintcdn.com/odella/PGZ7enNCqh0mvwj_/block-reference/assets/number_light.png?fit=max&auto=format&n=PGZ7enNCqh0mvwj_&q=85&s=c89c00cedf62b7c48871d0c53fe439d8" alt="Number Block Screenshot" className="block dark:hidden" width="532" height="274" data-path="block-reference/assets/number_light.png" />

  <img src="https://mintcdn.com/odella/I7v1Fbrp2kx7rLoj/block-reference/assets/number_dark.png?fit=max&auto=format&n=I7v1Fbrp2kx7rLoj&q=85&s=f55e8411f23e1540bd2495c15b02fe85" alt="Number Block Screenshot" className="hidden dark:block" width="596" height="306" data-path="block-reference/assets/number_dark.png" />
</Frame>

## Inputs

<ParamField path="input" type="any">
  The value to be converted into a number. This input is only available if the "Use Value Input" setting is enabled. If the input cannot be converted to a number, the block will use the Value setting instead.
</ParamField>

## Outputs

<ResponseField name="value" type="number">
  The output number value. This can either be a constant value or a converted input value.
</ResponseField>

## Editor Settings

<ParamField path="value" type="number" default={0}>
  The constant number value to be outputted. This value is used when either:

  * The "Use Value Input" setting is disabled
  * The "Use Value Input" setting is enabled but no input is connected
  * The "Use Value Input" setting is enabled but the input cannot be converted to a number
</ParamField>

<ParamField path="useValueInput" type="boolean">
  When enabled, shows an input port that accepts any value and attempts to convert it to a number.
</ParamField>

<ParamField path="round" type="boolean" default={false}>
  When enabled, rounds the output number to the specified number of decimal places.
</ParamField>

<ParamField path="roundTo" type="number" default={0}>
  The number of decimal places to round to when the "Round" setting is enabled.
</ParamField>

## Example: Output a constant number

1. Add a Number Block to your flow.
2. Set the `Value` to `123.456`.
3. Run the flow. The `value` output of the Number Block will be `123.456`.

<Frame>
  <img src="https://mintcdn.com/odella/63rQpScaEp0bDpCd/images/number-block-example-01.png?fit=max&auto=format&n=63rQpScaEp0bDpCd&q=85&s=94d35ddb2cd89874ca2f05bdaa97f0e0" alt="Number Block Example 1" width="338" height="207" data-path="images/number-block-example-01.png" />
</Frame>

## Example: Convert a string to a number

1. Add a Text Block to your flow and set the text to `"123.456"`.
2. Add a Number Block and enable the `Use Value Input` setting.
3. Connect the Text Block to the `input` of the Number Block.
4. Run the flow. The `value` output of the Number Block will be `123.456`.

<Frame>
  <img src="https://mintcdn.com/odella/63rQpScaEp0bDpCd/images/number-block-example-02.png?fit=max&auto=format&n=63rQpScaEp0bDpCd&q=85&s=c9ac348d42cd22880f850e36b2ce6608" alt="Number Block Example 2" width="589" height="223" data-path="images/number-block-example-02.png" />
</Frame>

## Example: Round a number

1. Add a Number Block to your flow.
2. Set the `Value` to `123.456`.
3. Enable the `Round` setting and set `Round To` to `2`.
4. Run the flow. The `value` output of the Number Block will be `123.46`.

<Frame>
  <img src="https://mintcdn.com/odella/63rQpScaEp0bDpCd/images/number-block-example-03.png?fit=max&auto=format&n=63rQpScaEp0bDpCd&q=85&s=1220a7d4047fa72be94cdfd13c1db80b" alt="Number Block Example 3" width="563" height="199" data-path="images/number-block-example-03.png" />
</Frame>

## Error Handling

The Number Block will not error under normal circumstances. If the input value cannot be converted to a number when "Use Value Input" is enabled, it will default to using the Value setting.

## FAQ

<AccordionGroup>
  <Accordion title="Can I use the Number Block to convert a boolean to a number?">
    Yes, you can use the Number Block to convert a boolean to a number. A `true` value will be converted to `1` and a `false` value will be converted to `0`.
  </Accordion>

  <Accordion title="What happens if I connect a non-numeric value to the Input of the Number Block?">
    The Number Block will attempt to convert the input value to a number. If the conversion is not possible, the block will default to using the Value setting.
  </Accordion>

  <Accordion title="Can I use the Number Block to round a number to an integer?">
    Yes, you can use the Number Block to round a number to an integer by enabling the `Round` setting and setting `Round To` to `0`.
  </Accordion>
</AccordionGroup>

## See Also

* [Text Block](/block-reference/data/text)
* [Bool Block](/block-reference/data/boolean)
* [Compare Block](/block-reference/logic/compare)
