Re: want to spread my code over different files
- From: "Arjen Markus" <arjen.markus@xxxxxxxxxx>
- Date: 29 Mar 2007 23:37:51 -0700
On 29 mrt, 22:02, Ulrich Schöbel <ulr...@xxxxxxxxxxx> wrote:
Am Thu, 29 Mar 2007 00:11:53 -0700 schrieb Arjen Markus:
On 29 mrt, 07:29, "raul" <rahuldotpa...@xxxxxxxxx> wrote:
hi
i want to have a global array which is populated in one file say file1
and then accessed and printed in the other file say file2.how do i do
this.
can you please show me a small sample code for this?
Regards
raul
File 1: a.tcl
global myarr
set myarr(1) 2
set myarr(2) 3
File 2: b.tcl
global myarr
puts "$myarr(1), $myarr(2)"
File 3: c.tcl
# Put it all together
source a.tcl
source b.tcl
The global command gives access to one or more global variables
regardless of where they are defined in the source files.
Regards,
Arjen
Hi Arjen,
there's no need for the global commands in File 1 or File 2.
Regards
Ulrich- Tekst uit oorspronkelijk bericht niet weergeven -
- Tekst uit oorspronkelijk bericht weergeven -
Hi Ulrich,
yes, you are right, but I would use them anyway as a form
of documentation.
Regards,
Arjen
.
- References:
- want to spread my code over different files
- From: raul
- Re: want to spread my code over different files
- From: Arjen Markus
- Re: want to spread my code over different files
- From: Ulrich Schöbel
- want to spread my code over different files
- Prev by Date: Re: OPPORTUNITY FOR EXPERT Tcl/Tk DEVELOPER
- Next by Date: Re: wiki
- Previous by thread: Re: want to spread my code over different files
- Next by thread: Re: want to spread my code over different files
- Index(es):
Relevant Pages
|