Re: basic issue with do and :=
- To: mathgroup at smc.vnet.net
- Subject: [mg60423] Re: [mg60402] basic issue with do and :=
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Fri, 16 Sep 2005 03:49:03 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
Clear[a, b]; a[i_] := i; b[i_] := a[i] + 1; b[1000] 1001 Bob Hanlon > > From: "David" <isolanoster at gmail.com> To: mathgroup at smc.vnet.net > Date: 2005/09/15 Thu AM 05:16:22 EDT > Subject: [mg60423] [mg60402] basic issue with do and := > > Hi all, > > this works as (I) expected > > ------------------------- > Do[a[i] = i, {i, 10}] > Do[b[i] =a[i]+1, {i, 10}] > ------------------------- > > While this doesn't: > > -------------------------- > Do[a[i] = i, {i, 10}] > Do[b[i] :=a[i]+1, {i, 10}] > --------------------------- > > [note ":=" instead of "=" on the second line]. > > namely the output is: "b[2]:=a[i]+1" for all i > > > > Is there any compact way to define: "b[i] :=a[i]+1" for all i ? > > > Thank you in advance, > > David > >