Declaring
In LIGO, there are two types of numbers: integers and natural numbers.
Integer literals are the same found in mainstream programming languages, for example,
10
,-6
and0
, but there is only one canonical zero:0
(so, for instance,-0
and00
are invalid).Natural numbers are written as digits followed by the suffix
n
, like so:12n
,0n
, and the same restriction on zero as integers applies:0n
is the only way to specify the natural zero.
Contrary to integral numbers in other programming languages, numbers in LIGO have arbitrary-precision, that is, they do not overflow or underflow. (See Mavryk-specific features for more).
Digits of large numbers can be separated by an underscore, to increase readability.
As a form of documentation, a type can be ascribed to each constant: