Re: Subscripted local variables in Module
- To: mathgroup at smc.vnet.net
- Subject: [mg24008] Re: Subscripted local variables in Module
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 20 Jun 2000 03:07:27 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <8ikdfu$qkm@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
x[1]=1 is a function value definition *not* a "subscripted"
locl variable. You mean
Module[{x}, x[1] = 1;
x[2] = 2;
x[1] + x[2]]
Regards
Jens
skker wrote:
>
> Why can't I use subscripted local variables in a Module?
>
> Module[{x[1], x[2]},
> x[1] = 1;
> x[2] = 2;
> x[1] + x[2]
> ]
> doesn't work. I could fix this code by replacing x[1] by x and x[2] by
> y. But there is a more serious problem when I want a non-fixed number of
>
> local variables.