lrange
Extracts a sublist from a list, returning elements from the first index to the last index (inclusive).
Syntax
tcl
lrange list first lastParameters
- list: The list to extract from
- first: Starting index (0-based, or
end,end-N) - last: Ending index (inclusive, or
end,end-N)
Indices are clamped to the valid range of the list. If first > last, an empty list is returned.
Examples
Basic sublist extraction
Output
Using end-relative indices
Output
Get all but first and last
Output
Indices clamped to valid range
Output
