xHarbour Reference Documentation > Operator Reference |
Literal array.
{[<expressions,...>]}
This operator is used as a delimiter for creating references to literal arrays. Expressions listed within the curly braces are evaluated and their return value is stored in the elements of the newly created array.
Note: When a variable is declared as STATIC, the expressions may only be constant values that can be resolved at compile time.
See also: | [ ] (array), {=>}, Array(), Hash() |
Category: | Operators , Special operators |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example creates arrays of different dimensions. PROCEDURE Main LOCAL aAge := {12, 15, 11, 9, 11, 14} // one dimensional LOCAL aUsers := { {"John", 31}, ; // two dimensional {"Marc", 28}, ; {"Bill", 33} } LOCAL aVal := { Date(), ; // three dimensional { 1, 2, {.T., "Ok"} }, ; "Third Element" } ? aAge[3] // result: 11 ? aUsers[2][1] // result: Marc ? aVal[2,3,2] // result: Ok ? aVal[3] // result: Third Element RETURN
http://www.xHarbour.com