Is it possible to assign a value to many vars in the same line?
Something like: set {mickey donald minnie} 0
:-?
And is it possible something like this:
if {(cond1) && (cond2)} {
puts stdout "yeah, it's possible!"
}
Thanks in advance!
Manu
--
Emanuele D'Arrigo
3D Animator & Modeller
Munich Animation film GmbH
Germany
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Yes :
set varnames [list var1 var2 var3] ; foreach var $varnames {set $var
0}
technically ,it's all on one line, but in two commands.
> And is it possible something like this:
>
> if {(cond1) && (cond2)} {
> puts stdout "yeah, it's possible!"
> }
Yes.
> set varnames [list var1 var2 var3] ; foreach var $varnames {set $var 0}
>
> technically ,it's all on one line, but in two commands.
Ah, ok... it's not as compact as i would. No prob.
> > And is it possible something like this:
> >
> > if {(cond1) && (cond2)} {
> > puts stdout "yeah, it's possible!"
> > }
>
> Yes.
Strange... last time i tried it didn't work... =(
Thanks anyway.
It does not work for textual boolean values. e.g. false, true.
--
Paul Duffin
DT/6000 Development Email: pdu...@hursley.ibm.com
IBM UK Laboratories Ltd., Hursley Park nr. Winchester
Internal: 7-246880 International: +44 1962-816880
What I sometimes do is this:
set mickey [set donald [set minnie 0]]]
But I don't find it particularly readable.
--
Bryan Oakley mailto:oak...@channelpoint.com
ChannelPoint, Inc. http://purl.oclc.org/net/oakley
> > > And is it possible something like this:
> > >
> > > if {(cond1) && (cond2)} {
> > > puts stdout "yeah, it's possible!"
> > > }
> >
> > Yes.
>
> Strange... last time i tried it didn't work... =(
>
> Thanks anyway.
ok, I did test this before I replied, so look at this:
set x 1 ;# a TRUE value
set y 1 ;#another TRUE
if { $x && $y } {puts stdout "yeah, it's possible"}
tcl> yeah, it's possible
or,
if {[info exists x] && [info exists y]} {puts stdout "OK"}
tcl> OK
or just to make sure,
if {[info exists x] && [info exists foobar]} {puts stdout "yeah, sure"}
tcl>
(no output, && evaluted to FALSE)
> > Something like: set {mickey donald minnie} 0
> What I sometimes do is this:
> set mickey [set donald [set minnie 0]]]
> But I don't find it particularly readable.
I agree, but the idea is genial. =)