Numbers are a way to represent any ordinal limited by your computer's memory.
Cheddar's numbers support decimals, separators, bases, and implicit promotion.
The most basic form of a number in Cheddar are integers and decimals. Cheddar wraps both of these in a "Number" type. You can write numbers as you would in most languages:
1123123.456.1230.11.0
Often in programs you deal with large numbers. Numbers are often written with commas to distinguish the sections of the number. Cheddar provides a simple syntax for number separators, _
.
123_456 // Same as 1234561_2_3_4 // Same as 12341__2345 // same as 12345
As you can see, Cheddar does not enforce where you place your number separators.
You can type binary, octal, and hexadecimal literals in Cheddar:
0b1010 // *b*inary0xFF // He*x*adecimal0o0222 // *o*ctal
What's the zero at the beginning? That specified the amount of zeros to append to the integer section of the number. For example:
2b1 // equal to 0b1001xF // equal to 0xF0