new files

This commit is contained in:
Ingy döt Net 2013-04-10 12:38:42 -07:00
parent 3af7344581
commit 86c034bb8b
1364 changed files with 21352 additions and 0 deletions

View file

@ -0,0 +1,8 @@
set haystack {Zig Zag Wally Ronald Bush Krusty Charlie Bush Bozo}
foreach needle {Bush Washington} {
if {[set idx [lsearch -exact $haystack $needle]] == -1} {
error "$needle does not appear in the haystack"
} else {
puts "$needle appears at index $idx in the haystack"
}
}

View file

@ -0,0 +1,9 @@
set haystack {Zig Zag Wally Ronald Bush Krusty Charlie Bush Bozo}
foreach needle {Bush Washington} {
set indices [lsearch -all -exact $haystack $needle]
if {[llength $indices] == 0} {
error "$needle does not appear in the haystack"
} else {
puts "$needle appears first at index [lindex $indices 0] and last at [lindex $indices end]"
}
}