4D v19

collection.pop( )

Home

 
4D v19
collection.pop( )

collection.pop( )  


 

Die Funktion collection.pop( ) entfernt das letzte Element aus der Collection und gibt es als Funktionsergebnis zurück.

Hinweis: Diese Funktion ändert die ursprüngliche Collection.

Ist die Collection leer, gibt collection.pop( ) Undefiniert zurück.

collection.pop( ) lässt sich zusammen mit collection.push( ) für ein Feature "first-in, last-out stack" verwenden:

 C_COLLECTION($stack)
 $stack:=New collection //$stack=[]
 $stack.push(1;2) //$stack=[1,2]
 $stack.pop() //$stack=[1] gibt 2 zurück
 $stack.push(New collection(4;5)) //$stack=[[1,[4,5]]
 $stack.pop() //$stack=[1] gibt [4,5] zurück
 $stack.pop() //$stack=[] gibt 1 zurück



Siehe auch 

collection.push( )
collection.unshift( )

 
EIGENSCHAFTEN 

Produkt: 4D
Thema: Collections

Dieser Befehl kann in preemptive Prozessen laufen

 
SEITENINHALT 
 
GESCHICHTE 

 
ARTIKELVERWENDUNG

4D Programmiersprache ( 4D v19)
4D Programmiersprache ( 4D v19.1)