|
[Date Index]
[Thread Index]
[Author Index]
RE: Subscripted local variables in Module
- To: mathgroup at smc.vnet.net
- Subject: [mg24028] RE: [mg24003] Subscripted local variables in Module
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 20 Jun 2000 03:07:40 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
> -----Original Message-----
> From: skker [mailto:skker at skker.com]
To: mathgroup at smc.vnet.net
> 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.
>
The first argument in a Module must be a list of symbols; x[1] is not a
symbol but an expression. It is easy enough:
Module[{x},
x[1] = 1;
x[2] = 2;
x[1] + x[2]
]
3
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
Prev by Date:
Re: Subscripted local variables in Module
Next by Date:
how much graphics RAM?
Previous by thread:
Re: Subscripted local variables in Module
Next by thread:
Re: Subscripted local variables in Module
|