Variables within With statement
- To: mathgroup at smc.vnet.net
- Subject: [mg123660] Variables within With statement
- From: "Harvey P. Dale" <hpd1 at nyu.edu>
- Date: Thu, 15 Dec 2011 04:51:48 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
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
- Follow-Ups:
- Re: Variables within With statement
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: Variables within With statement
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: Variables within With statement
- From: Tomas Garza <tgarza10@msn.com>
- Re: Variables within With statement
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: Variables within With statement
- From: Ulrich Arndt <ulrich.arndt@data2knowledge.de>
- Re: Variables within With statement