# Assignment Statements

> [HTML Version](assignmentstatements.htm)

_Added January 2018_

**\{LET\} <variable> = <expression>**

Assignment statements assign values to variables. The LET keyword is a holdover from ancient versions of BASIC and is normally omitted. <variable> can be any scalar variable or an array element or, in some limited cases, an entire array; see [Whole Array Assignment](whole-array-assignment.md). <expression> can be any expression compatible or convertible to the type of the specified variable; see [Operators](operators.md). Examples:

TOTAL = (QTY \* PRICE) USING "######.##"

today\$ = odtim(0,0,0)

month(m) = "December"

Price = Fn'Get'Price(sku)

\$capitol("California") = "Sacramento"

ATE'SUPP = FLAGS and AGF\_ATE

IS'BOY = GENDER\$ = "M"



In all cases the assignment operator is the first "=" following the variable. Any other equal signs, as in the last example above, would be treated as comparison operators, resulting in a logical expression returning TRUE (-1) or FALSE (0). 

In some cases where the first operand is the same as the variable being assigned, you can use a shortcut syntax; see [Shortcut Operators](shortcutoperators.md). Example:

GRAND'TOTAL += LINE'TOTAL  \! same as GRAND'TOTAL = GRAND'TOTAL + LINE'TOTAL

FLAGS |= MBF\_KBD           \! same as FLAGS = FLAGS or MBF\_KBD



[MAP Statements](mapstatements.md) may also contain implicit assignment statements by appending the value after the size parameter, e.g.

MAP1 PI, F, 6, 3.14159

The above would be the equivalent of:

MAP1 PI, F, 6

PI = 3.14159



**See Also**

•	[Dynamic Overlays](dynamicoverlays.md)

•	[Ordered Map Key-Value Pair Assignment](elementassign-ordmap.md)

•	[Ordered Map Assignment](copyaddsubtractcollections.md)

•	[Gridmap Row-Column-Value Assignment](elementassign-gridmap.md)

**Subtopics**

- [Substring Assignment](substringassignment.md)

- [Whole Array Assignment](whole-array-assignment.md)