6. Literals

6.1. Integers

Integers may be separated by an _ for readability.

# Standard representation
299792458

# Alternate representation
299_792_458

Jam supports a variety of operations on integers.

# Addition
10 + 5 #=> 15

# Subtraction
10 - 5 #=> 5

# Multiplication
10 * 5 #=> 50

# Integer Division
10 // 5 #=> 2
5 // 3 #=> 1

# Division through implicit typecasting
5 / 3 #=> 1.666_666_666..

# Exponentiation
4 ** 2 #=> 16

See also

Language reference on integer literals Language reference on operations

Library reference on numericals

6.2. Floating Point

Floating point numbers have the same _ support and support the same set of operations.

# Standard representation
3.141592

# Alternate representation
3.141_592

# Addition
3.2 + 5.4 #=> 8.6

# Subtraction
3.2 - 5.4 #=> -2.2

# Multiplication
3.2 * 5.4 #=> 17.28

# Division
8.1 / 5.2 #=> 1.557_692_308

# Exponentiation
4.3 ** 2.1 #=> 21.3935_9435

See also

Language reference on float literals Language reference on operations

6.3. Booleans

The only valid boolean values are true and false.

See also

Language reference on boolean literals

Library reference on constants