Constants in the Rice
Constants
A constant in Rice is an identifier that returns a new instance with a constant value for each reference. It cannot be assigned an instance.
Only Rice or the application that uses it can define constants. It cannot be defined by the user. User can only refer to it as a preset identifier.
Reference priority
The constant has the lowest reference priority as the identifier. Therefore, the constant search is performed after the variables, fields, and getters are searched. If they have the same identifier as the constant, the constant is hidden. There is no special notation for referencing hidden constants.
Reserved variable
The following is a list of preset constants defined by Rice.
Name | Class | Description |
MAIN | main | The instance of the main class. |
DQ | string | The double quote character. |
NL | string | The new line character. |
TAB | string | The tab character. |
CR | string | The carriage return character. |
LF | string | The line feed character. |
IMAX | int | The maximum value in the int class. |
IMIN | int | The minimum value in the int class. |
LMAX | long | The maximum value in the long class. |
LMIN | long | The minimum value in the long class. |
RMAX | real | The maximum value in the real class. |
RMIN | real | The minimum value in the real class. |
EPSILON | real | The machine epsilon. |
NAN | real | The not a number. |
NINF | real | The negative infinity. |
PINF | real | The positive infinity. |
These constant names are not reserved words. For details of preset constants, refer to each manual.