Choose where you’d like to start

deleteKeys

Table of Contents

Overview

The deleteKeys function deletes specified elements, or keys(along with their values) from a collection.

Syntax

To delete keys along with their values:

<collectionVariable>.deleteKeys(<keysList>);

(OR)

To delete elements based on index values:

<collectionVariable>.deleteKeys(<indexList>);

where,

ParameterData typeDescription
<collectionVariable>COLLECTION

The variable from which key-value pairs will be deleted.

<keysList>LIST

The keys which will be deleted along with the values.

<indexList>LIST

Index values of elements which will be deleted.

Index starts from 0.

Examples

 productVersion = collection("Creator" : 5, "CRM" : 2, "Mail" : 8);
 productVersion.deleteKeys({"CRM", "Mail"}); // deletes the specified keys along with their values
 products = collection("Creator", "CRM", "Mail");
 products.deleteKeys({1, 2}); // deletes the elements "CRM" and "Mail"

Get Started Now

Execute