> next up previous contents index
: Type conversion : Variable values : Variable values   目次   索引

Access and affectation

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 $i$ serves as an index and accesses the $i^{th}$ 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]$\equiv$wine[0], 

wine[quality]$\equiv$wine[1],
wine[price]$\equiv$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$>1$.



Juan-Manuel Ahuactzin 平成17年3月31日