Let
Purpose 
Sets varX to the result of expressionX for the duration of calculation, until the script exits (local variables), or until the file is closed (global variables).
Format 
Let({[}var1=expression1{;var2=expression2...]};calculation)
Parameters 
var - any variable name, local variable name, or global variable name (see About naming fields for guidelines on naming variables).
expression - any calculation expression, field, or constant.
calculation - any calculation expression, field, or constant.
Parameters in curly braces { } are optional.
Data type returned 
text, number, date, time, timestamp, container
Originated in 
FileMaker Pro 7.0
Description 
Multiple variables are allowed when using a list syntax that is enclosed in square brackets [ ] and is separated by semicolons. For example:
Let([variable=value;variable2=value2];calculation)
The $ symbol references a local variable and two $$ symbols reference a global variable. An optional repetition number appears in square brackets [ ] immediately after the variable name. For example:
Let([$variable[repetition]=value;$$variable2=value2]{;calculation} )
The Let function sets the variables from left to right. You can use previously defined variables (for example, variables that you defined with the Set Variable script step) to define new variable values, and you can nest one Let function within another. If you use a previously defined variable within a nested Let function, the variable has scope only within the nested function (as if you had defined a completely unique variable). See the City example shown below.
Once defined, local and global variables can be referenced in any calculation within their scope. The scope of global variables is limited to the current file. The scope of local variables is the current script. Local variables defined in a calculation are scoped to the file but are only available when scripts are not running. A local and global variable (or even two local variables in different scripts) can have the same name but they are treated as different variables and store different values.
Examples 
Let(x=5;x*x) returns 25.
Let([x=5;squared=x*x;cubed=squared*x];cubed) returns 125.
Let(City=“Paris”;Let(City=“San Francisco”;City&“-“)&City) returns San Francisco - Paris.
The following example sets a local variable counter at repetition 50 with a value of 120:
Let($counter[50]=120;$counter[50]*2) returns 240.
The following example shows how to pass named parameters using the Evaluate, Let, and Get(ScriptParameter) functions, allowing access only to variable “a” (the example returns 6):
ScriptParameter = "a = 5; b = 10"
Evaluate("Let([" & Get(ScriptParameter) & "]; a+1 )" )
The following example shows how to pass named parameters, allowing access to both variable “a” and variable “b”. The simplified first parameter makes the second parameter more complex (the example returns 6, 12):
ScriptParameter = "a = 5; b = 10"
Evaluate("Let( [" & Get(ScriptParameter) & "]; a+1 & \", \" & b+2 )" )
The following example shows how to pass named parameters, while keeping the ability to check the syntax of the second parameter of the Let function (the example returns 6, 12):
ScriptParameter = "a = 5; b = 10"
Let([a = Evaluate("Let( [" & Get(ScriptParameter) & "]; a )"),b = Evaluate("Let( [" & Get(ScriptParameter) & "]; b )")]; a+1 & ", " & b+2 )
Related topics 
Functions reference (category list)
Functions reference (alphabetical list)
About formulas
About functions
Defining calculation fields
Using operators in formulas
Using variables