Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

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.


  • 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