This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v19.8
collection.shift( )

collection.shift( ) 


 

collection.shift () -> Function result 
Parameter Type   Description
Function result  Text, Number, Object, Collection, Date in First element of collection

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
Number: 805257

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v16 R6

 
ARTICLE USAGE

4D Language Reference ( 4D v19)
4D Language Reference ( 4D v19.1)
4D Language Reference ( 4D v19.4)
4D Language Reference ( 4D v19.5)
4D Language Reference ( 4D v19.6)
4D Language Reference ( 4D v19.7)
4D Language Reference ( 4D v19.8)