HistoryCal - V0.0.7 Manual
let Statement

Home Development V0.0.7 Manual Script let Statement

let Statement

The let statement is used to introduce a named variable and initialize it or change the value of an existing variable. If a variable already exists then the let at the start is optional.

The type of the variable is determined by the expression used.

let Statement
FormatExampleResult
let name = expr; let result = 20 * 345; result holds field value 6900
let name += expr; let result += 50; result holds field value 6950
let name -= expr; let result -= 6000; result holds field value 950
let name *= expr; let result *= 3; result holds field value 2850
let name /= expr; let result /= 10; result holds field value 285
name = expr; result = 50 ~ 30; result holds range value 30 ~ 50
name = expr; result = "Hello"; result holds string value "Hello"
name += expr; result += " world"; result holds string value "Hello world"

Example Script
let day = date,g:dmy "1sep2017"; let result = string,g:dmy (day + 5 * 7); writeln "Date 5 weeks from " + string,g:dmy day + " is: " + result; day -= 2 * 7; writeln "and a fortnight before was " + string,g:dmy day;
Output
Date 5 weeks from 1 Sep 2017 is 6 Oct 2017
and a fortnight before was 18 Aug 2017

Valid XHTML 1.0 Strict

12th October 2016