Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

20
Task/Menu/Tcl/menu-1.tcl Normal file
View file

@ -0,0 +1,20 @@
proc select {prompt choices} {
set nc [llength $choices]
if {!$nc} {
return ""
}
set numWidth [string length $nc]
while true {
set i 0
foreach s $choices {
puts [format " %-*d: %s" $numWidth [incr i] $s]
}
puts -nonewline "$prompt: "
flush stdout
gets stdin num
if {[string is int -strict $num] && $num >= 1 && $num <= $nc} {
incr num -1
return [lindex $choices $num]
}
}
}

31
Task/Menu/Tcl/menu-2.tcl Normal file
View file

@ -0,0 +1,31 @@
% puts >[select test {}]<
><
% puts >[select "Which is from the three pigs" {
"fee fie" "huff and puff" "mirror mirror" "tick tock"
}]<
1: fee fie
2: huff and puff
3: mirror mirror
4: tick tock
Which is from the three pigs: 0
1: fee fie
2: huff and puff
3: mirror mirror
4: tick tock
Which is from the three pigs: skdfjhgz
1: fee fie
2: huff and puff
3: mirror mirror
4: tick tock
Which is from the three pigs:
1: fee fie
2: huff and puff
3: mirror mirror
4: tick tock
Which is from the three pigs: 5
1: fee fie
2: huff and puff
3: mirror mirror
4: tick tock
Which is from the three pigs: 2
>huff and puff<