>
: Type conversion
: Variable values
: Variable values
目次
索引
The value of a variable on a plValues is access
using the ``[ ]'' operator, either to affect it or refer it. Two types
of arguments are accepted by the bracket operator: a plSymbol or
an integer. A plSymbol accesses the variable contained on it; an
integer
serves as an index and accesses the
element on the
plValues. The elements preserves the same order used at the
definition. For example, given plValues wine(year^quality^price)
we have the following equivalencies:
wine[year]

wine[0]
,
wine[quality]

wine[1]
,
wine[price]

wine[2]
As in C++ arrays you cannot scape to start indexation from 0. Also,
accessing with non-included symbols or invalid indexes will generate
errors. For instance consider that we now define
plValues wine(year^quality)
then wine[price]
or
wine[2]
will generate a run time error as well as wine[i]
for all i
.
Juan-Manuel Ahuactzin
平成17年3月31日