       Re: Table local

• To: mathgroup at smc.vnet.net
• Subject: [mg113809] Re: Table local
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Sun, 14 Nov 2010 06:07:43 -0500 (EST)

```http://reference.wolfram.com/mathematica/ref/Table.html

"Table[expr, spec] first evaluates spec, then localizes the variable specified, and successively assigns values to it, each time evaluating expr."

In other words, what is localized is the index i

Clear[i, u];
Table[u = i^2, {i, 5}];
{i, u}

{i, 25}

Clear[i, u];
u = 0; Table[u += i^2, {i, 5}];
{i, u}
u == Sum[i^2, {i, 5}]

{i, 55}

True

Bob Hanlon

---- EF <he.frauendorfer at t-online.de> wrote:

=============

Table effectively uses Block to localize values or variables.

But
Clear[u];
Table[u = i^2, {i, 5}];
u

Clear[u];
Table[u = i^2;, {i, 5}];
u

In both cases the value 25 for u is given.
If u were really local, it should have no value outside of the Table

For me there is a contradiction that can cause a lot of trouble

E. F.

```

• Prev by Date: Re: Table local
• Next by Date: Re: Sort a List, in a List of Lists of Lists
• Previous by thread: Re: Table local
• Next by thread: Sort a List, in a List of Lists of Lists