Posted to tcl by dandyn at Thu May 23 17:39:13 GMT 2024view raw

  1. # Adds module to the 'mods' list.
  2. if {[info exists mods]} {
  3. if {[lsearch -exact $mods $foxTag] == -1 } { lappend mods $foxTag }
  4. } else {variable mods [list $foxTag]}
  5.  
  6.  
  7. # or
  8.  
  9. # Adds module to the 'mods' list.
  10. if {[info exists mods]} {
  11. if {![string match "*$foxTag*" $mods]} {variable mods "$mods $foxTag"}
  12. } else {variable mods $foxTag}

Comments

Posted by dandyn at Thu May 23 17:47:10 GMT 2024 [text] [code]

set foxTag fox set mods "bbc fox aft svt" # Adds module to the 'mods' list. if {[info exists mods]} { if {[lsearch -exact $mods $foxTag] == -1 } { lappend mods $foxTag } } else {variable mods [list $foxTag]} puts "\tlist:\t $mods" # or # Adds module to the 'mods' list. if {[info exists mods]} { if {![string match "*$foxTag*" $mods]} {variable mods "$mods $foxTag"} } else {variable mods $foxTag} puts "\tstring:\t $mods"

Posted by dandyn at Thu May 23 20:59:36 GMT 2024 [text] [code]

set foxTag fox set mods "bbc fox aft svt" # Adds module to the 'mods' list. if {[info exists mods]} { if {[lsearch -exact $mods $foxTag] == -1 } { lappend mods $foxTag } } else {variable mods [list $foxTag]} puts "\tlist:\t $mods" # or # Adds module to the 'mods' list. if {[info exists mods]} { if {![string match "*$foxTag*" $mods]} {variable mods "$mods $foxTag"} } else {variable mods $foxTag} puts "\tstring:\t $mods"