Please enable JavaScript to view this site.

 

Navigation: Macros > Macro Language > Instructions

Assigning Values to Variables

Scroll Prev Up Next More

To assign the value of an expression to a variable, follow the name of the variable by an equal sign and the expression whose value you wish to store into the variable.

bIsLeapYear = false
nYear = 1999
sMyName = 'Olivier'
nCount = nCount + 23
nToday = Today()
nDateEaster = GetEasterFor(nYear)
nWeekDay = WeekdayOf(Today())
nMayFirst = FirstDateOfMonth(YearOf(Today()),5)

Note that

 

•The instruction x = y does not test if x equals y, and it does not define x as being equal to y. It tells the computer to make the value of x the same as the value of y, now.

•The values of x and y may each be modified in subsequent instruction so that x is never equal to y again.

•The equal sign here is not to be confused with the strict equality operator ==, which tests for equality.

 

The expression and the variable receiving its value must have matching data types. Use a type conversion function when needed; for example, sRESULT = 'Date is ' + IntToStr(25).

 

See also: calling functions.

 


Topic 105129, last updated on 16-Oct-2026