1)
I want to write a procedure decr as incr command in tcl.
I have already done this:
Code: Select all
proc decr { var } { set ${var} "[expr ${var} - 1]" }
Tcl error: can't read "$var": no such variable
set variable_name variable_value
variable_name = ?
variable_value = ?
2)
I want to have a procedure which has as input an expression
examples:
proc chk { expr } { if {$expr} { return "true" } }
[chk "1 = 1"] -> true
[chk "string match a hsagsa'] -> true
[chk "3 >= 4"] -> null
but my code just checks if $expr is/isn't " "
Any help?