aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-List.remove_item.3
blob: 12662797ad89f0572c9446994f6e183fe282eb07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'\" t
.\" Copyright (c) 2025 Bruce Hill
.\" All rights reserved.
.\"
.TH List.remove_item 3 2025-11-29 "Tomo man-pages"
.SH NAME
List.remove_item \- remove an item by value
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI List.remove_item\ :\ func(list:\ @[T],\ item:\ T,\ max_count:\ Int\ =\ -1\ ->\ Void)
.fi
.SH DESCRIPTION
Removes all occurrences of a specified item from the list.


.SH ARGUMENTS

.TS
allbox;
lb lb lbx lb
l l l l.
Name	Type	Description	Default
list	@[T]	The mutable reference to the list. 	-
item	T	The item to be removed. 	-
max_count	Int	The maximum number of occurrences to remove. 	-1
.TE
.SH RETURN
Nothing.

.SH NOTES
A negative `max_count` means "remove all occurrences".

.SH EXAMPLES
.EX
list := [10, 20, 10, 20, 30]
list.remove_item(10)
assert list == [20, 20, 30]

list.remove_item(20, max_count=1)
assert list == [20, 30]
.EE
.SH SEE ALSO
.BR Tomo-List (3)