Literals
Bool, Double, Int32,
Int64, and String literals can be present in
an expression.
- A
Boolliteral can be eithertrueorfalse. - A
Doubleliteral is a decimal number that either contains the decimal separator (e.g.,3.5,.5,3.) or is given in the scientific notation (e.g.,1e-4,1.5e3). A Double literal must be between(2 - 2 ^ -52) * 2 ^ 1023(~ 1.79 * 10 ^ 308) and-(2 - 2 ^ -52) * 2 ^ 1023(~ -1.79 * 10 ^ 308). Moreover, the magnitude of a literal cannot be less than2 ^ -1074(~ 4.94 * 10 ^ -324). Furthermore,- a
NaN(not a number) value can be specified through theDouble("nan")expression, - an
Inf(positive infinity) value can be specified through theDouble("inf")expression, - and a
-Inf(negative infinity) value can be specified through theDouble("-Inf")expression.
- a
- Integer literals without a suffix are of the
Int32type (e.g.,14). AnInt32literal must be between2 ^ 31 - 1(= 2147483647) and-2 ^ 31(= -2147483648). - The
Lsuffix is used to createInt64literals (e.g.,14L). AnInt64literal must be between2 ^ 63 - 1(= 9223372036854775807L) and-2 ^ 63(= -9223372036854775808L). - A
Stringliteral appears within double quotes, as in"I'm a string literal". The escape character\can be used to represent new line (\n), tab (\t), double quote (\") characters, as well as the escape character itself (\\).