Int and Float

Gleam's main number types are Int and Float.

Ints

Ints are "whole" numbers.

1
2
-3
4001

Gleam has several operators that work with Ints, all of which return Ints.

1 + 1 // => 2
5 - 1 // => 4
5 / 2 // => 2
3 * 3 // => 9
5 % 2 // => 1

Floats

Floats are numbers that have a decimal point.

1.5
2.0
-0.1

Floats also have their own set of operators.

1.0 +. 1.4 // => 2.4
5.0 -. 1.5 // => 3.5
5.0 /. 2.0 // => 2.5
3.0 *. 3.1 // => 9.3