[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 { }
 Literal array and code block delimiters         (Special)
------------------------------------------------------------------------------
 Syntax

     { <exp list> }                 (literal array)
     { |<param list>| <exp list> }  (code block definition)

 Operands

     <exp list> is a list of expressions of any type.  If the item is a
     literal array definition, it can contain another literal array
     definition.

     <param list> is a list of variables to receive parameters passed to
     a code block from an invocation of the EVAL() function.  The parameter
     list is comma-separated and must be enclosed by vertical bars (||).
     Variables specified in this list are declared local to the code block
     and are visible only within the code block definition.

 Description

     Curly braces ({}) delimit references to literal arrays or code blocks.
     If the reference is a literal array, you can use them to create an array
     in either an assignment or a variable declaration statement.  If the
     reference is a variable declaration, the array can contain expressions
     of any kind as elements, unless STATIC is the declaration statement.  In
     this case, the literal array can only contain constant values.

 Examples

     .  This example uses literal arrays in declaration statements to
        create a variable and initialize it with an array reference:

        LOCAL aPerson := { "Name", "Address", DATE() }
        STATIC aNumList := { 1, 2, 3, 4, 5, 6, 7, 8 }

     .  This example creates a multidimensional literal array:

        aMulti := { {1, 2, 3}, {"A", "B", "C"} }

     .  This example uses curly braces to formulate a simple code
        block with a single parameter:

        LOCAL bSayBlock
        bSayBlock := { |x| QOUT(x) }
        EVAL(bSayBlock, 10)               // Result: 10


See Also: EVAL() LOCAL PRIVATE PUBLIC STATIC
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson