beautypg.com

Statement: let – Rockwell Automation 1771-DB Basic Module User Manual - Series A User Manual

Page 66

background image

Operating Functions

Chapter 5

5–29

Mode: COMMAND AND/OR

RUN

Type:

ASSIGNMENT

Use the

LET statement to assign a variable to the value of an

expression.

The general form of LET is:

LET [var] = [expr]

Examples:

LET A =10*SIN(B)/100

or

LET A = A+1

Note that

the = sign used in the LET statement is not an equality

operator. It is a “replacement” operator. The statement

should be read

A is

replaced by A plus one. The word LET is always optional, (i.e.

LET A =2 is the same as A

=2).

When LET is

omitted the LET statement is called an IMPLIED

LET. We use

the word LET to refer to both the LET statement and

the

IMPLIED LET statement.

Also use the LET statement to assign the string

variables:

LET $(1)=“THIS

IS A STRING” or

LET $(2)=$(1)

Before

you can assign strings you must execute the STRING [expr],

[expr] statement or else a MEMORY ALLOCATION ERROR occurs.
See the following

section 5.4.31 titled, “STRING”.

5.4.18
Statement: LET