at, _at. Element access by index   [3.4.1]

^hash._at(index|-index) 
^h
ash._at[first|last] 
^hash.at(index|-index)   [3.4.4]
^hash.at[first|last]   
[3.4.4]
^hash.at(index|-index)[key|value|hash]   
[3.4.4]
^hash.at[first|last;key|value|hash]      
[3.4.4]

When adding elements to the hash, each of them gets its own index, starting from zero. The method returns element by the specified index, so ^hash.at(0) is equal to ^hash.at[first].
For negative index it is calculated from the end of the hash, so
^hash.at(-1) is equal to ^hash.at[last].

Optional second argument determines the result:
value - element value will be returned, by default,
key - element key will be returned,
hash - single element hash with be returned.



Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 27.01.2021