EnglishРусский  
 Share/Save/Bookmark
 

Numbers

The Gentee language has several numeric types. There are several ways to specify natural numbers or integers.

Decimal form

The most widely used form.

Example: 65, -45367, 0

Hexadecimal form

Numbers must begin with 0X or 0x. Characters from A to F can be used in upper or lower case.

Example: 0xВA23, 0x1d2f, 0XFFFFFF

Binary form

Numbers in binary form must begin with 0b or 0B and consist only of 0 or 1.

Example: 0b11001, 0B1010110110, 0b10101011000011

Character code

You can specify a specific character instead of the number corresponding to it, by enclosing the character in single quotation marks.

Example: 'A', '(', 'k', '2', '='

Gentee also has types called long and ulong. Each type occupies 8 bytes. To define such numbers, add L or l at the end.

Example: 23l, 0xfaafd45fff67fffL, -24363627252652L

Real numbers

There are two types of real numbers: double and float. A number with a decimal point or with a mantissa is of the double type. To define a number of the float type, you should add F or f at the end. To specify a number of the double type without a decimal point and a mantissa, you should add D or d at the end.

Examples of double numbers: 123.122, -123.2е-2, 789D

Examples of float numbers: 12.75f, 0.55F, -78F

Edit