4D v18

collection.push( )

Accueil

 
4D v18
collection.push( )

collection.push( )  


 

La méthode collection.push( ) ajoute un ou plusieurs élément(s) à la fin de la collection d'origine et retourne la collection modifiée.

Note : Cette méthode modifie la collection d'origine.

 C_COLLECTION($col)
 $col:=Creer collection(1;2) //$col=[1,2]
 $col.push(3) //$col=[1,2,3]
 $col.push(6;Creer objet("firstname";"John";"lastname";"Smith"))
  //$col=[1,2,3,6,{firstname:John,lastname:Smith}

Vous souhaitez trier la collection résultante :

 C_COLLECTION($col;$sortedCol)
 $col:=Creer collection(5;3;9) //$col=[5,3,9]
 $sortedCol:=$col.push(7;50).sort()
  //$col=[5,3,9,7,50]
  //$sortedCol=[3,5,7,9,50]



Voir aussi  

collection.pop( )
collection.shift( )

 
PROPRIÉTÉS 

Produit : 4D
Thème : Collections
Nom intl. : collection.push( )

Commande(s) éligible(s) à l'exécution dans un process préemptif

 
PAGE CONTENTS 
 
HISTORIQUE 

 
UTILISATION DE L'ARTICLE

4D - Langage ( 4D v18)