Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7253
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newspump.sol.net!post2.nntp.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail |
|---|---|
| From | Ulrich Arndt <ulrich.arndt@data2knowledge.de> |
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Variables within With statement |
| Date | Fri, 16 Dec 2011 10:41:11 +0000 (UTC) |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Sender | steve@smc.vnet.net |
| Approved | Steven M. Christensen <steve@smc.vnet.net>, Moderator |
| Message-ID | <jcf787$6eq$1@smc.vnet.net> (permalink) |
| References | <201112150951.EAA22803@smc.vnet.net> |
| Lines | 24 |
| NNTP-Posting-Date | 16 Dec 2011 09:45:56 GMT |
| NNTP-Posting-Host | aa37dce4.news.twtelecom.net |
| X-Trace | DXC=?T:j1KCCd\28W0SG3emHW:C_A=>8kQj6==_1NR_H?JP=[C23MPmcBI0EFiONJ7[Go6U_ak6blRFh= |
| X-Complaints-To | abuse@twtelecom.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:7253 |
Show key headers only | View raw
Any special reason for With usage?
Otherwise use Block
Block[{ a = 5, b = a 10}, a + b]
Ulrich
Am 15.12.2011 um 10:51 schrieb Harvey P. Dale:
> Is there any easy way to have one variable within a With
> statement take its value from a prior variable in the same With
> statement? For example, if I evaluate With[{a = 5, b = 10 a}, a + b], I
> get 5 + 10a, and what I want is 55. I can get there like this: With[{a
> = 5}, With[{b = 10 a}, a + b]] -- which does produce 55 -- but it would
> be nicer if I could use a single With statement and get b, within it, to
> take its value from a.
>
> Thanks.
>
> Harvey
>
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Variables within With statement Ulrich Arndt <ulrich.arndt@data2knowledge.de> - 2011-12-16 10:41 +0000
csiph-web