wineyekumar
wineyekumar

Reputation: 53

How to access variable without using $ (dollar) sign

Can I access a variable in Tcl without using $ (dollar) sign? Can I assign one variable value to new variable without using dollar sign?

Example:

set x 10

I need to access value of x without dollar sign.

Upvotes: 2

Views: 377

Answers (1)

Peter Lewerin
Peter Lewerin

Reputation: 13252

Well, yes. The $x notation is actually shorthand for the invocation set x, so you can do this:

set x 10      ;# assign to variable
puts [set x]  ;# access the value
set y [set x] ;# assign value to other variable

Upvotes: 4

Related Questions