# LET

Syntax: {LET}Variable = Value

## Function

Sets Variable equal to the value of Value.

- Variable is a variable/constant/expression (0-65535).
- Value is a variable which will be set equal to Value.

## Explanation

LET is an optional instruction for the BASIC Stamp 1 that can be used with variable assignment statements, such as A = 5 and B = A + 2, etc. This instruction is not required and only exits on the BASIC Stamp 1. LET was a commonly used command in early forms of BASIC, and was originally included in the BS1 command set to accommodate programmers from that generation. Parallax recommends that all new BASIC Stamp 1 programs use assignment statements without the LET command.

The example below demonstrates the use of LET in assignment statements. Note that the Lunchtime and Dinnertime routines do essentially the same type of thing, but the Dinnertime approach is recommended.

    ' {$STAMP BS1}
    ' {$PBASIC 1.0}
    ' {$STAMP BS1}

    SYMBOL salad  = B1
    SYMBOL bread  = B2
    SYMBOL soup   = B3
    SYMBOL lunch  = B4
    SYMBOL dinner = B5

    Lunchtime:
      LET salad = 3
      LET bread = 1
      LET soup  = 4
      lunch = salad + bread + soup
      DEBUG "Lunch = $", #lunch, "plus local tax.", CR

    Dinnertime:
      salad = 4
      bread = 2
      soup  = 5
      dinner = salad + bread + soup
      DEBUG "Dinner = $",#dinner, "plus local tax.", CR

Go to Welcome page

BASIC Stamp Help Version 2.5.4

Copyright © Parallax Inc.

8/8/2012