$FUNCNAME$
  AEVAL()
$CATEGORY$
  Array
$SUMMARY$
   Execute a code block for each element in an array
$LANG_RU$
         .
$SYNTAX$

     AEVAL(<aArray>, <bBlock>,
	[<nStart>], [<nCount>]) --> aArray


$LANG_RU$

     AEVAL(< >, < >, [< >],
	 [<- >]) -->  


$ARGUMENTS$

     <aArray> is the array to traverse.

     <bBlock> is a code block to execute for each element encountered.

     <nStart> is the starting element.  If not specified, the default is
     element one.

     <nCount> is the number of elements to process from <nStart>.  If not
     specified, the default is all elements to the end of the array.


$LANG_RU$

     < > -    .

     < > -  ,    
      .

     < > -     .
      < >  ,    
      .

     <- > -  ,  
           < >.
      <- >  ,   
       .


$RETURNS$

     AEVAL() returns a reference to <aArray>.


$LANG_RU$

     AEVAL()    < >.


$DESCRIPTION$

     AEVAL() is an array function that evaluates a code block once for each
     element of an array, passing the element value and the element index as
     block parameters.  The return value of the block is ignored.  All
     elements in <aArray> are processed unless either the <nStart> or the
     <nCount> argument is specified.

     AEVAL() makes no assumptions about the contents of the array elements it
     is passing to the block.  It is assumed that the supplied block knows
     what type of data will be in each element.

     AEVAL() is similar to DBEVAL() which applies a block to each record of a
     database file.  Like DBEVAL(), AEVAL() can be used as a primitive for
     the construction of iteration commands for both simple and complex array
     structures.

     Refer to the Code Blocks section in the "Basic Concepts" chapter of the
     Programming and Utilities Guide for more information on the theory and
     syntax of code blocks.


$LANG_RU$

     AEVAL() -    ,    
        ,      
      .     .  
       < >  <- >,
        .  AEVAL()  
      DBEVAL(),      
       .  DBEVAL(), AEVAL()  
            
          .    
              
     " "   " "


$EXAMPLES$

       This example uses AEVAL() to display an array of file names
	and file sizes returned from the DIRECTORY() function:

	#include "Directry.ch"
	//
	LOCAL aFiles := DIRECTORY("*.dbf"), nTotal := 0
	AEVAL(aFiles,;
	   { | aDbfFile |;
	      QOUT(PADR(aDbfFile[F_NAME], 10), aDbfFile[F_SIZE]),;
	      nTotal += aDbfFile[F_SIZE]);
	   } )
	//
	?
	? "Total Bytes:", nTotal

       This example uses AEVAL() to build a list consisting of
	selected items from a multidimensional array:

	#include "Directry.ch"
	//
	LOCAL aFiles := DIRECTORY("*.dbf"), aNames := {}
	AEVAL(aFiles,;
	   { | file | AADD(aNames, file[F_NAME]) };
	   )

       This example changes the contents of the array element
	depending on a condition.  Notice the use of the codeblock
	parameters:

	LOCAL aArray[6]
	AFILL(aArray,"old")
	AEVAL(aArray,;
	{|cValue,nIndex| IF(cValue == "old",;
			  aArray[nIndex] := "new",)})


$LANG_RU$

         AEVAL()      
           ,    
       DIRECTORY():

       #include "Directry.ch"
       //
       LOCAL aFiles := DIRECTORY("*.dbf"), nTotal := 0
       AEVAL( aFiles, ;
       { | aDbfFile |;
       QOUT(PADR(aDbfFile[F_NAME], 10), aDbfFile[F_SIZE]),;
       nTotal += aDbfFile[F_SIZE];
       };
       )
       //
       ?
       ? "Total Bytes :", nTotal

         AEVAL()    
          :

       #include "Directry.ch"
       //
       LOCAL aFiles := DIRECTORY("*.dbf"), aNames := {}
       AEVAL(aFiles,;
       { | file | AADD(aNames, file[F_NAME]) };
       )


$SEEALSO$
  DBEVAL(),EVAL(),QOUT(),
$END$
