0 language syntax, 1 lexical elements, 1 identifiers – Rice Lake iRite IDE User Manual

Page 14: 2 keywords, 3 constants, Language syntax, Identifiers, Keywords, Constants

Advertising
background image

10

920i

Programming Reference

3.0

Language Syntax

3.1

Lexical Elements

3.1.1

Identifiers

An identifier is a sequence of letters, digits, and underscores. The first character of an identifier must be a letter
or an underscore, and the length of an identifier cannot exceed 100 characters. Identifiers are not case-sensitive:
“HELLO” and “hello” are both interpreted as “HELLO”.

Examples:

Valid identifiers:

Variable12
_underscore
Std_Deviation

Not valid identifiers: 9abc

First character must be a letter or an underscore.

ABC DEF

Space (blank) is not a valid character in an identifier.

Identifiers are used by the programmer to name programs, data types, constants, variables, and subprograms. You
can name your identifiers anything you want as long as they follow the rules above and the identifiers is not
already used as a keyword or as a built-in type or built-in function. Identifiers provide the “name” of an entity.
Names are bound to program entities by declarations and provide a simple method of entity reference. For
example, an integer variable iCounter (declared

iCounter : integer

) is referred to by the name iCounter.

3.1.2

Keywords

Keywords are special identifiers that are reserved by the language definition and can only be used as defined by
the language. The keywords are listed below for reference purposes. More detail about the use of each keyword
is provided later in this manual.

and

array

begin

builtin

constant

database

else

elsif

end

exit

for

function

handler

if

integer

is

loop

mod

not

of

or

procedure

program

real

record

return

step

stored

string

then

to

type

var

while

3.1.3

Constants

Constants are tokens representing fixed numeric or character values and are a necessary and important part of
writing code. Here we are referring to constants placed in the code when a value or string is known at the time of
programming and will never change once the program is compiled. The compiler automatically figures out the
data type for each constant.

Note

Be careful not to confuse the constants in this discussion with identifiers declared with the keyword
constant, although they may both be referred to as constants.

Three types of constants are defined by the language:

Integer Constants:

An integer constant is a sequence of decimal digits. The value of an integer constant is

limited to the range 0…2

31

– 1. Any values outside the allowed range are silently truncated.

Literally, any time a whole number is used in the text of the program, the compiler creates an integer constant.
The following gives examples of situations where an integer constant is used:

iCount : integer := 25;

for iIndex := 1 to 3

sResultString := IntegerToString(12345);

sysResult := StartTimer(4);

Advertising
This manual is related to the following products: