For Programmers: Free Programming Magazines  


Home > Archive > Tcl > November 2006 > proc parameter $switch "no such variable" why?









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]

 

Author proc parameter $switch "no such variable" why?
comp.lang.tcl

2006-11-25, 10:05 pm

[TCL]
proc XML_GET_ALL_ELEMENT_ATTRS {fileName parseString {switch {}}} {
if {![string equal $switch -body]} {
# DO STUFF
}
}
[/TCL]

I stripped the proc down to this but I get the following error anyway:

can't read "switch": no such variable while executing "string equal
$switchx -body" (file "xml_procs.tcl" line 1)

So now it's more than just XML parsing, it's TCL as a whole that I am
losing a grip with, please help!

Thanx
Phil

Gerald W. Lester

2006-11-25, 10:05 pm

comp.lang.tcl wrote:
> [TCL]
> proc XML_GET_ALL_ELEMENT_ATTRS {fileName parseString {switch {}}} {
> if {![string equal $switch -body]} {
> # DO STUFF
> }
> }
> [/TCL]
>
> I stripped the proc down to this but I get the following error anyway:
>
> can't read "switch": no such variable while executing "string equal
> $switchx -body" (file "xml_procs.tcl" line 1)
>
> So now it's more than just XML parsing, it's TCL as a whole that I am
> losing a grip with, please help!


The error message you have posted has nothing to do with the procedure you
have posted but rather the contents of a file named xml_procs.tcl.

Also, I'm guessing you typed the error in rather than cut and paste since
one spot in the error message says "switch" and the other says "switchx".

--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com