25.01.2015 Views

Using Caché ObjectScript - InterSystems Documentation

Using Caché ObjectScript - InterSystems Documentation

Using Caché ObjectScript - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5<br />

Operators and Expressions<br />

<strong>Caché</strong> supports many different operators, which perform various actions, including mathematical actions, logical comparisons,<br />

and so on. Operators act on expressions, which are variables or other entities that ultimately evaluated to a value. This<br />

chapter describes expressions and the various <strong>ObjectScript</strong> operators. It contains the following topics:<br />

• Introduction to Operators and Expressions<br />

• Arithmetic Operators<br />

• Logical Comparison Operators<br />

• String Operators<br />

• Numeric Relational Operators<br />

• String Relational Operators<br />

• Pattern Matching<br />

• Indirection<br />

5.1 Introduction to Operators and Expressions<br />

Operators are symbolic characters that specify the action to be performed on their associated operands. Each operand<br />

consists of one or more expressions or expression atoms. When used together, an operator and its associated operands have<br />

the following form:<br />

[operand] operator operand<br />

Some operators take only one operand and are known as unary operators; others take two operands and are known as binary<br />

operators.<br />

An operator and any of its operands taken together constitute an expression. Such expressions produce a result that is the<br />

effect of the operator on the operand(s). They are classified based on the types of operators they contain.<br />

• An arithmetic expression contains arithmetic operators, gives a numeric interpretation to the operands, and produces<br />

a numeric result.<br />

• A string expression contains string operators, gives a string interpretation to the operands, and produces a string result.<br />

• A logical expression contains relational and logical operators, gives a logical interpretation to the operands, and produces<br />

a boolean result: TRUE (1) or FALSE (0).<br />

<strong>Using</strong> <strong>Caché</strong> <strong>ObjectScript</strong> 31

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!