aArrayTraversed array.
AdvPL GuideAEval( <aArray>, <bBlock>, [nStart], [nCount] ) --> aRetExecutes a block for each element in a range.
The block receives the element and its index. In multidimensional arrays, a first-level element may be a nested array; AEval does not automatically traverse every cell. Individual block results do not build a new mapped collection: write into a separate destination for that. The example accumulates a sum without modifying source values. (TOTVS, s.d., ref. 1)
AEval( <aArray>, <bBlock>, [nStart], [nCount] ) --> aRetaArrayTraversed array.
bBlockBlock receiving element and index.
nStartFirst position; default 1.
nCountCount from the starting position; defaults through the end.
Array after the operation; do not assume independent cloning.
#Include "Protheus.ch"
User Function EdAeval()
Local aValues := {10, 20, 30}
Local nTotal := 0
// The accumulator is external; no assignments change the array.
AEval(aValues, {|nValue| nTotal += nValue})
ConOut(cValToChar(nTotal))
Return NilExpected result: 60. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use
Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.