Login
7 branches 0 tags
Ben (X13/Arch) Simplified things a little 0643405 9 days ago 1260 Commits
nujel / docs / stable / 1.3-numbers.md

[ 1.2 - Comments | 1.4 - Arithmetic ]


Numbers

Nujel supports normal decimal notation and treats , and _ as whitespace characters so you can split big numbers for increased legibility. There is also special syntax for binary, octal and hexadecimal literals. Scientific notation is not supported.

9 ; probably not that suprising
; => 9

100,0; possible, but probably shouldn't be commited that way
; => 1000

1,0,0,0; also a possibility...
; => 1000

1,000 ; much better!
; => 1000

1_000 ; Underscore is also workable, although mostly preferrable for non decimal literals
; => 1000

#b10000 ; This way we can write binary literals
; => 16

#b0001_0000 ; Especially here does it become useful that we can use _ and , to split our literal wherever we choose
; => 16

#x12_34 ; Also helps for hex literals
; => 4660

#o10 ; Octal literals are also possible
; => 8

0x123 ; Using an 0x prefix does NOT work and results in a read error being thrown
; => :read-error

-100 ; You can also write negative numbers


[ 1.2 - Comments | 1.4 - Arithmetic ]