PreviousNextIndex

Expression

A combination of one or more terms and operators that evaluate to a single value of a specific data type.

Syntax

[ unary-operator ] [ ( ] { term | term binary-operator term } [ ) ] 

unary-operator
(
term
binary-operator
)

For information on the precedence of operator evaluation, see Table 36.

Example

The procedure, r-expression.p, evaluates an expression to identify the value of an element in an ABL single-dimensional array (iArray) that is specified using two-dimensional coordinates (iDim1 and iDim2):

r-expression.p
DEFINE VARIABLE iDim1       AS INTEGER   NO-UNDO. 
DEFINE VARIABLE iDim2       AS INTEGER   NO-UNDO. 
DEFINE VARIABLE iDim1Extent AS INTEGER   NO-UNDO INITIAL 3. 
DEFINE VARIABLE iDim2Extent AS INTEGER   NO-UNDO INITIAL 5. 
DEFINE VARIABLE iArray      AS CHARACTER NO-UNDO EXTENT 15  
  INITIAL ["A","B","C","D","E",  /* iDim1 = 1 */ 
           "F","G","H","I","J",  /* iDim1 = 2 */ 
           "K","L","M","N","O"]. /* iDim1 = 3 */ 
DO iDim1 = 1 TO iDim1Extent: 
  DO iDim2 = 1 TO iDim2Extent: 
    MESSAGE "iArray[" iDim1 "," iDim2 "]" " = " 
      iArray[ iDim2 + (iDim1 - 1) * iDim2Extent ] VIEW-AS ALERT-BOX. 
  END. 
END. 

This procedure contains several expressions in the DO statements as well as in the MESSAGE statement. The expression that evaluates the index on the term, iArray, using a two-dimensional coordinate is shown in bold. This expression first evaluates the subtraction (-) operation in parentheses, then, in order by operator precedence, evaluates the multiplication (*) operation followed by the addition operation (+).

Notes
See also

Assignment (=) statement, ASSIGN statement, CATCH statement, COPY-LOB statement, Data types, ERROR-STATUS system handle, Parameter passing syntax


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex