Numbers
There are two types of numbers in Gren: integers and floating point.
Integers have the type Int
and represent a whole number:
Floating point numbers have the type Float
and are an approximation of a fractional number:
Gren also has a special number
type that can represent both.
You may have seen it in the repl:
You can use this for type signatures where it doesn’t matter if something is an Int or a Float:
Math
You can perfrom basic math operations on numbers using the typical operators:
Notice that the division operator returns floats:
You can perform integer division with //
:
For exponentation, use ^
:
For other math operations, see the Math module documentation.