MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Subscripted local variables in Module


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.


  • Prev by Date: Ret: Page break under program command?-- e.g. in a Print command
  • Next by Date: Re: Subscripted local variables in Module
  • Previous by thread: Ret: Page break under program command?-- e.g. in a Print command
  • Next by thread: Re: Subscripted local variables in Module