Expression evaluation

Top Up Down  A A

Facform provides a flexible method of obtaining the values of numbers and names by means of expressions. Expression evaluation is done as follows:

 

"..."  (text)

Quoted text. A value in quotes is a constant character value, e.g., "Mary"

 

number  (numeric value)

A value comprising digits, with or without a decimal point, is a constant numeric value, e.g., 23.4

 

+-*/^  (plus, minus, times, divide, exponent)

+ (plus), - (minus), * (multiply), / (divide), ^ (to the power of) are numeric operators. These are used in the evaluation of numeric quantities, e.g., 23+45  evaluates to 68.

 

+  (concatenate)

+ (plus) is used to put together, concatenate, character text.

E.g., "George"+" D. "+"Washington" evaluates to "George D. Washington".

 

><=  (greater, less, equal)

> (greater than), < (less than), = (equal to), >= (greater than or equal to), <= (less than or equal to), <> (not equal to) are used to compare values.

 

For numeric values, 23>12 yields the result of "true", or 1 as a numeric value. 23<12 yields the result of "false", or 0 as a numeric value.

 

For character values, "B">"A" yields the result of 1, meaning "true". "B"<"A" yields the result of 0 = "false", or 0 as a numeric value. Before character comparison, leading and trailing blanks are removed, e.g., "A   "="    A" is true, but "AB"="A   B" is false, because of the blanks between A and B.

 

&|  (and, or)

& (logical and), | (logical or) are used to combine numeric values, or the numeric outcome of <,>,=. A & B is 0 if either A or B or both are 0. A | B is 1 if either A or B or both are 1.

E.g., (A>1) & (B=0) evaluates to 0 if A is less than 1, or B is not zero.

(A=B) | (A=C) evaluates to 1 if A is equal to B or C, otherwise it is 0.

 

( )  (arrange order of expression evaluation)

Parentheses are used to set the order in which sub-expressions are evaluated. Evaluation proceeds from the inner-most sub-expression within parentheses outward. Otherwise, evaluation proceeds from left to right.

E.g., ((2+3)*(3+4)) evaluates to (5*(3+4)), then (5*7), then 35.

1+2*3 is evaluated left to right as (1+2)*3, then 3*3, then 9.


Help for Facform Rasch Measurement Software: www.winsteps.com.