Progress
Language Tutorial
for Character
Understanding Expressions
An expression is a combination of 4GL language elements that results in a single value. At a minimum, an expression consists of one operand, but can include multiple operands, operators, and functions.
An operand is a language element that represents a value. Operands include:
- Variables — A location in memory that holds a value that may change during the execution of a procedure.
- Database fields — An individual value from a database record.
- Widget attributes — A value that describes a characteristic of a widget like its width, height, and so on.
- Constants — A value that does not change during the execution of a procedure.
An operator is a language element that represents an action carried out on one or more operands. The successful combination of operands and operators, called an operation, always returns a value. For example, the equal sign (=) is a 4GL operator that assigns the value from the right side of the operator to the field or variable on the left side of the operator. The plus sign (+) is another operator that adds the operands on either side of the operator and returns the result.
A function is a prewritten program that performs a specific task and returns a value. A function is like an operand in that it represents a value, but it is also like an operator in that it represents an action. You can think of a function as a prepackaged solution to a task that can be used in an expression. Because the code already exists, either as a pre-defined function or one that you create as a user-defined function, it offers a shortcut to providing a programmed solution to a coding task or problem.
Progress supports pre-built Progress-supplied functions and user-defined functions. The 4GL contains many functions that perform a wide range of common tasks. For example, the ASC(character) function returns the ASCII integer code for a supplied character. Also, you can use the FUNCTION statement to create specific functions that suit your programming needs.
The sections that follow provide more information about expression components.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |