[NTLUG:Discuss] OT: Tcl/Tk question
Greg Edwards
greg at nas-inet.com
Mon Jul 19 22:08:25 CDT 2004
fredjame wrote:
> The following procedure is working, but I have noted that 'string match
> ...' already returns 1 on a match and 0 on no match. So my question is
> how to rewrite this without the 'if ...' and the extra 'return'? - it is
> a syntax question actually.
> Thank you in advance for any help you may be able to offer.
> Regards
> Fred James
>
> proc MatchColor {color} {
> If [string match *$color* [getMem Document ChannelNames]] {
> return 1
> }
> return 0
> }
>
>
How about
Proc MatchColor (color) {
set result [string match *$color* [getMem Document ChannelNames]]
return $result
}
--
Greg Edwards
Software Engineering Services - http://consult.nas-inet.com
Custom Hosted Websites - http://www.nas-inet.com
More information about the Discuss
mailing list