---
title: number()
slug: number
docTags: 
createdAt: 2021-09-14T17:47:18.000Z
---

Given a value, returns that value as a `Number`.&#x20;

### Syntax

`number(value)`

- `value` - the `Number`, `Money`, `Percent`, `Enum`, `Boolean`, or `String` value to be converted by the function.
- **Return type:** [Number](docId\:ucI5tCTfVBhonEJ6ZQijg)&#x20;

### Sample usage

`number($100)` returns `100`.

`number(string(base))` returns the original value of `base`.

### Supported data types

| **Input type**                              | **Return type**                         | **Logic**                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------------------------- | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ****[Number](docId\:ucI5tCTfVBhonEJ6ZQijg)  | [Number](docId\:ucI5tCTfVBhonEJ6ZQijg)  | If a Number value is passed, the same Number value will be returned.                                                                                                                                                                                                                                                                                                                                 |
| [Money](docId:_kS5D2xbfoR9d8WfRIVnY)        | [Number](docId\:ucI5tCTfVBhonEJ6ZQijg)  | If a Money value is passed, the amount will be returned as a Number.                                                                                                                                                                                                                                                                                                                                 |
| [Percent](docId\:FbN7bFaHlFPV4f1C53DxA)     | [Number](docId\:ucI5tCTfVBhonEJ6ZQijg)  | If a Percent value is passed, the amount will be returned as a Number of subtype Decimal where `50%` is equivalent to `.5`.                                                                                                                                                                                                                                                                          |
| [Enum](docId\:UnTq2eAL5RMIpNYczvfw1)        | [Number](docId\:ucI5tCTfVBhonEJ6ZQijg)  | If a numeric scale Enum value is passed, the numeric value is returned as a Number.                                                                                                                                                                                                                                                                                                                  |
| [Boolean](docId\:kdvwA4oPcqWedHpYCTH4L)     | [Number](docId\:ucI5tCTfVBhonEJ6ZQijg)  | If a Boolean value is passed, `true` will return the Number value `1`, and `false` will return the Number value `0`.                                                                                                                                                                                                                                                                                 |
| [String](docId\:Ujw2AQAktel5uukLuP73S)      | [Number](docId\:ucI5tCTfVBhonEJ6ZQijg)  | If a String value is passed, its constituent characters will be evaluated for compatibility with the Number data type. Characters which are compatible will be returned as a Number value. If two or more sets of compatible characters are separated by non-compatible characters (ex. `"121yes121"`), the compatible sets of characters will be returned as comma-separated values (ex. `121,121`) |
| *Unsupported data types*                    | **[Null](docId\:N9trVqonnBknqL9DrNBP6)  | Unsupported data types return `Null`.                                                                                                                                                                                                                                                                                                                                                                |

