how to detect if not in list code example
Example 1: python variable not in list
>>> 3 not in [2, 3, 4]
False
>>> 3 not in [4, 5, 6]
True
Example 2: tcl check if value exists in list
# Make List object
set List_to_Search [list 1 2 3 4 5 6 7 8 9];
# Identify item to search for:
set findMe 7;
# Search List using lsearch, returns index of first occurrence found
set index [lsearch $List_to_Search $findMe];
# > 6
puts "$findMe = [lindex $List_to_Search $index]";
# If object isn't contained in list - returns '-1' as index:
set notFound [lsearch $List_to_Search 99];
puts "99 not found in List; $notFound";