4D v19

collection.shift( )

Home

 
4D v19
collection.shift( )

collection.shift( )  


 

The collection.shift( ) method removes the first element of the collection and returns it as the function result.

Note: This method modifies the original collection.

If the collection is empty, this method does nothing.

Example  

 C_COLLECTION($c)
 $c:=New collection(1;2;4;5;6;7;8)
 $val:=$c.shift()
  // $val=1
  // $c=[2,4,5,6,7,8]



See also 

collection.push( )
collection.unshift( )

 
PROPERTIES 

Product: 4D
Theme: Collections

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

 
ARTICLE USAGE

4D Language Reference ( 4D v19)
4D Language Reference ( 4D v19.1)