Literals (topic)

Literals are values of a specific type. The following table shows the different types of literals supported by the Basic Control Engine:

Literal

Description

10

Integer whose value is 10.

43265

Long whose value is 43,265.

5#

Double whose value is 5.0. A number's type can be explicitly set using any of the following type-declaration characters:

 

%

Integer

 

&

Long

 

#

Double

 

!

Single

5.5

Double

Value is 5.5. Any number with decimal point is considered a double.

5.4E100

Double

Expressed in scientific notation.

&HFF

Integer

Expressed in hexadecimal.

&O47

Integer

Expressed in octal.

&HFF#

Double

Expressed in hexadecimal.

"hello"

String

Of five characters: hello.

"""hello"""

String

Of seven characters: "hello". Quotation marks can be embedded within strings by using two consecutive quotation marks.

#1/1/1994#

Date value whose internal representation is 34335.0. Any valid date can appear with #'s. Date literals are interpreted at execution time using the locale settings of the host environment. To ensure that date literals are correctly interpreted for all locales, use the international date format:

#YYYY-MM-DD HH:MM:SS#

Constant Folding

The Basic Control Engine supports constant folding where constant expressions are calculated by the compiler at compile time. For example, the expression

   i% = 10 + 12

is the same as:

   i% = 22

Similarly, with strings, the expression

   s$ = "Hello," + " there" + (46)

is the same as:

   s$ = "Hello, there."

More information

L