sergelaurent
Technical User
I have the following script!!! I expected that the getproc function returns "coucou" but it returns "et non".
/***************************************************/
set toto 156
proc getproc {chiffre} {
switch $chiffre {
$toto {set phrase "coucou"}
default {set phrase "et non"}
}
}
set tomi 156
set titi [getproc $tomi]
puts $titi
/***********************************************/
It seems to me that in the switch command, it does not evaluate the $toto!!!
Can someone tell me how to force switch to compare $chiffre with the content of the toto variable!!!
/***************************************************/
set toto 156
proc getproc {chiffre} {
switch $chiffre {
$toto {set phrase "coucou"}
default {set phrase "et non"}
}
}
set tomi 156
set titi [getproc $tomi]
puts $titi
/***********************************************/
It seems to me that in the switch command, it does not evaluate the $toto!!!
Can someone tell me how to force switch to compare $chiffre with the content of the toto variable!!!