aSourceArray to modify.
AdvPL GuideADel( <aSource>, <nPos> ) --> aRetRemoves an element without reducing array length.
ADel shifts following elements backward and leaves Nil in the last position. Len stays unchanged. If the intent also removes the excess slot, use ASize after validating the position. Saved indexes for later elements may no longer identify the same items. (TOTVS, s.d., ref. 1)
ADel( <aSource>, <nPos> ) --> aRetaSourceArray to modify.
nPosValid position starting at 1.
Array resulting from removal.
#Include "Protheus.ch"
User Function EdAdel()
Local aItems := {"A", "B", "C"}
Local nPos := 2
If nPos >= 1 .And. nPos <= Len(aItems)
// Shift first, then remove the excess final slot.
ADel(aItems, nPos)
ASize(aItems, Len(aItems) - 1)
EndIf
ConOut(aItems[2])
Return NilExpected result: {"A", "C"}, output C. 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.