lets

Assigns values to multiple variables and evaluates the expression using those variables.
Accepts
Returns
Syntax
lets(variable, value, variable2, value2, ..., expression) variable.lets(value, variable2, value2, ..., expression)

lets(
    a, "Hello",
    b, " world!",
    [a, b].join(" ")
)lets(

    /* Create an 'a' variable and assign it the string "Hello" */
    a, "Hello",

    /* Create a 'b' variable and assign it the string " world!" */
    b, " world!",

    /* Combine the 'a' and 'b' variable values together with + */
    [a, b].join(" ")
    
)
=
Hello world! "Hello world!"

 

JavaScript
lets(
    a, "Hello",
    b, " world!",
    [a, b].join(" ")
)
JavaScript
lets(
	date, prop("Date").dateAdd(1, "months"),
	lastDay, date.dateSubtract(date.date(), "days"),
	lastDay.day().test("6|7")
		? lastDay.dateSubtract(-5 + lastDay.day(), "days") 
		: lastDay
)
JavaScript
lets(
	range, 
	prop("Dates").dateStart() != prop("Dates").dateEnd(),
	from, 
	range && prop("Dates").dateStart().test("AM|PM") 
		? prop("Dates").dateStart().formatDate("h:mm A") 
		: "",
	to, 
	range && prop("Dates").dateEnd().test("AM|PM") 
		? prop("Dates").dateEnd().formatDate("h:mm A") 
		: "",
	(from ? from : "")
	+ (from && to ? " → " + to : "")
)