Powered By GitBook
WITH_UNIQUE_ITEM
Add unique item to the list

Description

Returns a new list which contains the given item at the end of the list, but only if the exact item does not already exist in the list. If it does, the original list is returned.

Function signature

1
WITH_UNIQUE_ITEM(list: Array, item: ) => Array
Copied!
Parameter
Description
List
List to add item to
Item
Item to add

Examples

1
numbers = [100,3,20]
2
animals = ["cat","dog"]
3
empty = []
Copied!
Formula
Return value
WITH_UNIQUE_ITEM(numbers, 4)
[100,3,20,4]
WITH_UNIQUE_ITEM(numbers, 3)
[100,3,20]
WITH_UNIQUE_ITEM(animals, "pig")
["cat","dog","pig"]
WITH_UNIQUE_ITEM(empty, 4)
[4]
Last modified 11mo ago
Export as PDF
Copy link