Assigning Values to Variables

Assigning the value of an expression to a variable is simple. Type the name of the variable followed 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 equal sign used is not the same as the equal sign you encountered in high school algebra. The instruction x = y does not test if x equals y; 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.

•However, 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.

Assignments, although simple, are the cornerstone of Macros, since the ultimate goal of any macro is to assign a value to sRESULT or bRESULT or both. The value of these 2 variables is then used, along with the corresponding Macros Rules property, to determine how Macro Tokens are processed by Q++.

Topic 105129 updated on 01-Nov-16.

Topic URL: https://www.qppstudio.net/webhelp/index.html?assigningvaluestovariables.htm