MathGroup Archive 2011

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

Search the Archive

Re: Variables within With statement

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123689] Re: Variables within With statement
  • From: Ulrich Arndt <ulrich.arndt at data2knowledge.de>
  • Date: Fri, 16 Dec 2011 05:40:35 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201112150951.EAA22803@smc.vnet.net>

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
> 




  • Prev by Date: Re: Does Union[] reliably sort?
  • Next by Date: Re: precision of y-axis values in plot
  • Previous by thread: Variables within With statement
  • Next by thread: Re: Variables within With statement