Skip to content

Commit 7734428

Browse files
authored
Merge pull request #157 from kevanstannard/numeric-literal-separator
Document numeric literal separators
2 parents 8797851 + 20712b6 commit 7734428

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pages/docs/manual/latest/primitive-types.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,14 @@ ReScript's `true/false` compiles into a JavaScript `true/false`.
158158

159159
**Careful when you bind to JavaScript numbers**! Long ones might be truncated. Bind JS number (especially Dates) as **float** instead.
160160

161+
To improve readability, you may place underscores in the middle of numeric literals such as `1_000_000`. Note that underscores can be placed anywhere within a number, not just every three digits.
162+
161163
## Floats
162164

163165
Float requires other operators: `+.`, `-.`, `*.`, `/.`, etc. Like `0.5 +. 0.6`. See [Js.Float](api/js/float) for helper functions.
164166

167+
As with integers, you may use underscores within literals to improve readability.
168+
165169
## Unit
166170

167171
The `unit` type has a single value, `()`. It compiles to JavaScript's `undefined`. It's a dummy type used as a placeholder in various places. You won't need it until you see it.

0 commit comments

Comments
 (0)