Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
proc kk {pr_to} {
if { $pr_to eq "inv" } then {
set gate inv
#puts "inv"
} elseif { $pr_to=="nor" } then {
set gate nor
#puts "nor"
} else {
set gate none
#puts "none"
}
puts $gate
}
kk inv
Its working fine and its also setting.. u need to declare as global if u puts outside procedure..
if u call inside this u will get the gate value perfectly..
I think have tried to use the variable $gates outside this procedure.. So mention as global if u need outside...
- - - Updated - - -
proc kk {pr_to} {
global gate
if { $pr_to eq "inv" } then {
set gate inv
#puts "inv"
} elseif { $pr_to=="nor" } then {
set gate nor
#puts "nor"
} else {
set gate none
#puts "none"
}
#puts $gate
}
kk inv
puts $gate
Here is ur code have inv value in gate outside procedure..
This is k or u need more help..:razz:
- - - Updated - - -
ya sun_ray u got it.....
no tcl code should not need ; for end of the line like c or perl..
we can write simply as above code..
Hai sun_ray,,
<<1>>
$env(variable_name) is environmental variable
$variable_name is a normal variable
enviromental variable can be setted in a terminal window itself..
using below command..Here gate_name is environmental variable..
setenv gate_name inv
just type the above line in terminal. We can call this environmental variable in any language according to their syntax.
In tcl we call it by
$env(gate_name)
Normal variables can be setted and called simply as
set gate inv
$gate
<<2>>
consider
a variable has value 1
b variable has value 2
proc_name 1 2
if u give value directly u can use this..
but if u want to pass
proc_name $var1 $var2
u can also pass variable like this..
proc_name [puts $a] [puts $b]
Its a evaluate funciton [].. What u r doing here is printing "a" value and "b" value
Its equal to
proc_name "1" "2"
The main usage of [] is to perform some operation.. then send the value to the function similar to eval function:razz:
environmental variable are used for the child process in d sense where ever u want..
Main usage:-
we can get this environmental variable value in any language like perl,tcl,shell etc..,
proc_name [puts $a] [puts $b]
u can also do like this... but its an extra thing u r adding.. So it will increase the run time because it will call to puts function and then it will send to procedure..
.
proc_name [puts $a] [puts $b]
u can also do like this... but its an extra thing u r adding.. So it will increase the run time because it will call to puts function and then it will send to procedure..
.