Download HDevelop User's Guide

Transcript
7.5 Expressions for Input Control Parameters
Types
i
integer
a
arithmetic, that is: integer or real
b
boolean
s
string
v
all types (atomic)
t
all types (tuple)
Table 7.3: Symbols for the operation description.
7.5
Expressions for Input Control Parameters
In HDevelop, the use of expressions like arithmetic operations or string operations is limited to control
input parameters; all other kinds of parameters must be assigned by variables.
7.5.1
General Features of Tuple Operations
This section intends to give you a short overview over the features of tuples and their operations. A more
detailed description of each operator mentioned here is given in the following sections.
Please note that in all following tables variables and constants have been substituted by letters which
indicate allowed data types. These letters provide information about possible limitations of the areas of
definition. The letters and their meaning are listed in table 7.3. Operations on these symbols can only be
applied to parameters of the indicated type or to expressions that return a result of the indicated type.
The symbol names i, a, l, and s can denote atomic tuples (tuples of length 1) as well as tuples with
arbitrary length.
Operations are normally described assuming atomic tuples. If the tuple contains more than one element,
most operators work as follows:
• If one of the tuples is of length one, all elements of the other tuples are combined with that single
value for the chosen operation.
• If both tuples have a length greater than one, both tuples must have the same length (otherwise a
runtime error occurs). In this case, the selected operation is applied to all elements with the same
index. The length of the resulting tuples is identical to the length of the input tuples.
• If one of the tuples is of length 0 ([]), a runtime error occurs.
In table 7.4 you can find some examples for arithmetic operations with tuples. Pay special attention to
the order in which the string concatenations are performed. The basic arithmetic operations in HDevelop
are +, -, *, /. Please note that + is a dimorphic operation: If both operands are numeric, it adds numbers.
If at least one of the operands is a string, it concatenates both operands as strings.
Language
Symbol
273