Home > Archive > Tcl > January 2006 > if statement
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| Could someone tell me how to write this in TCL:
If the variable called VAR doesn't exist then set VAR to zero.
This:
if {![info exists VAR]} then {
set VAR 0
}
gives me a syntax error.
Thanks!
Matt
| |
| Andreas Leitgeb 2006-01-24, 7:05 pm |
| Matt <email@invalid.net> wrote:
> Could someone tell me how to write this in TCL:
> If the variable called VAR doesn't exist then set VAR to zero.
> This:
> if {![info exists VAR]} then {
> set VAR 0
> }
> gives me a syntax error.
This piece of code works perfectly well for me.
Are you sure, you didn't have a typo in it, when
you tried? Or did you execute it in something
else than tclsh ?
If you quoted the exact syntax-error, we could say more.
| |
|
| Andreas Leitgeb wrote:
> Matt <email@invalid.net> wrote:
>
> This piece of code works perfectly well for me.
>
> Are you sure, you didn't have a typo in it, when
> you tried? Or did you execute it in something
> else than tclsh ?
>
> If you quoted the exact syntax-error, we could say more.
Oh sorry! You're right, the error was referring to a different
line in the script.
I think I'd better take a break now.
|
|
|
|
|