# Let

The let statement is a complement to the set statement, used for defining script variables. The let statement, in opposition to the set statement, evaluates the expression on the right side of the ' =' before it is assigned to the variable.

Syntax:

Let variablename=expression

The word let may be omitted, but the statement then becomes a control statement. Such a statement without the keyword let must be contained within a single script row and may be terminated either with a semicolon or end-of-line.

Examples and results:

Examples and results

| Example | Result |
| --- | --- |
| `Set x=3+4;`<br>`Let y=3+4;`<br>`z=$(y)+1;` | `$(x)` will<br>be evaluated as ' 3+4 '<br><br>`$(y)` will<br>be evaluated as ' 7 '<br><br>`$(z)` will<br>be evaluated as ' 8 ' |
| Let T=now(<br>); | `$(T)` will be given the value of the current<br>time. |

## Learn more

* [Set](https://help.qlik.com/en-US/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptRegularStatements/Set.htm)
* [Script variables](https://help.qlik.com/en-US/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptVariables.htm)