Next: , Previous: Numeric Types, Up: Numeric Types



3.3.1 Numeric Constants

count constants are just strings of digits: 1234 and 0 are examples.

integer constants are strings of digits preceded by a + or - sign: -42 and +5 for example. Because digit strings without a sign are of type count, occasionally you need to take care when defining a variable if it really needs to be of type int rather than count. Because of type inferencing , a definition like:

         local size_difference = 0;

will result in size_difference having type count when int is what's instead needed (because, say, the size difference can be negative). This can be resolved either by using an int constant in the initialization:

         local size_difference = +0;

or explicitly indicating the type:

         local size_difference: int = 0;

You write floating-point constants in the usual ways, a string of digits with perhaps a decimal point and perhaps a scale-factor written in scientific notation. Optional + or - signs may be given before the digits or before the scientific notation exponent. Examples are -1234., -1234e0, 3.14159, and .003e-23. All floating-point constants are of type double.