Evaluating Expressions at Runtime

value Function

Syntax

value(expr)

{the} value of expr

What it Does

Returns the value of its parameter evaluated as a SenseTalk expression. One use of this would be to accept text entered by a user that might contain an expression (such as "12.95 + 6%") and calculate its value. Another would be to read a file containing a list or property list and quickly convert it from the text format stored in the file into a useful collection of values.

The expression is evaluated in the context of the current handler. It may include variables (such as total in the second example above), operators, function calls, and so forth. If the evaluationContext property is set to Global or Universal, variables are treated as global or universal rather than local. If an error occurs while obtaining the value of the expression, the result() function returns an exception object describing the problem.

Examples

put the value of "51+93" into sum -- sets sum to 144

put value("total is greater than quarter" & bestQtrNum) into best

put value("(" & commaSeparatedText &")") into myList

put the value of file "storedProperties" into pList

See Also: the Merge Function, and the do command.

 

This topic was last updated on June 21, 2019, at 02:49:49 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2019 Eggplant