Literals

Bool, Double, Int32, Int64, and String literals can be present in an expression.

  • A Bool literal can be either true or false.
  • A Double literal 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 than 2 ^ -1074 (~ 4.94 * 10 ^ -324). Furthermore,
    • a NaN (not a number) value can be specified through the Double("nan") expression,
    • an Inf (positive infinity) value can be specified through the Double("inf") expression,
    • and a -Inf (negative infinity) value can be specified through the Double("-Inf") expression.
  • Integer literals without a suffix are of the Int32 type (e.g., 14). An Int32 literal must be between 2 ^ 31 - 1 (= 2147483647) and -2 ^ 31 (= -2147483648).
  • The L suffix is used to create Int64 literals (e.g., 14L). An Int64 literal must be between 2 ^ 63 - 1 (= 9223372036854775807L) and -2 ^ 63 (= -9223372036854775808L).
  • A String literal 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 (\\).