Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 171

Advertising
background image

Chapter
Statements

11

11 -19

Use the LET statement to assign a variable to the value of an expression.

The = sign used in the LET statement is not an equality operator. It is a
replacement operator. The statement should be read var is replaced expr.
The word LET is always optional (ex.

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 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 (page 11 -37) or else a memory allocation error occurs that
causes the module to enter the Command mode.

Syntax

LET

var = expr

Example

>1 REM EXAMPLE PROGRAM

>10 LET A = 10*SIN(C)/100

>20 LET B = B +1

LET

Advertising