Skip to content

Numbers

Numbers is the basic fundamental thing of every programming language. Numbers can be used for calculation by binary operations, can provide you tool to compare anything with boolean (0 - false, 1 - true) presentation.
All terms like: bytes / strings / objects and etc. at the end is just numbers.

Toy Programming Language compiler allows you to create numbers constants.
Currently supported ways to write numbers is: decimal, hexadecimal and binary

tpl-lang
// 3 ways to write "15"

15 -- decimal
0b1111 -- binary
0xF -- hexadecimal

You can do any math operations with the provided constants:

tpl-lang
0b1101 + 0xF * 2;