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.


NameClassDescription
MAINmainThe instance of the main class.
DQstringThe double quote character.
NLstringThe new line character.
TABstringThe tab character.
CRstringThe carriage return character.
LFstringThe line feed character.
IMAXintThe maximum value in the int class.
IMINintThe minimum value in the int class.
LMAXlongThe maximum value in the long class.
LMINlongThe minimum value in the long class.
RMAXrealThe maximum value in the real class.
RMINrealThe minimum value in the real class.
EPSILONrealThe machine epsilon.
NANrealThe not a number.
NINFrealThe negative infinity.
PINFrealThe positive infinity.

These constant names are not reserved words. For details of preset constants, refer to each manual.

Copyright © Rice All rights reserved.