Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Printing Variables and Their Values

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46422] Re: Printing Variables and Their Values
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 17 Feb 2004 07:05:52 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <c0s8vq$sme$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

SetAttributes[PrintSet, HoldAll]


PrintSet[] := Null
PrintSet[v1_, vm___] := (Print[Unevaluated[v1], " = ", v1];
PrintSet[vm])


and try

x = 7; y = 5;z=q;

PrintSet[x,y,z]

Regards
  Jens


"Bruce W. Colletti" wrote:
> 
> Re Mathematica 5.0.1.
> 
> For a list of variables, how would I successively print each variable's
> name followed by its value?
> 
> For instance, when x = 7, y = 5 and z = 4, feed list {x,y,z} into
> a function that prints "x = 7, y = 5, z = 4."
> 
> Although Print["x = ", x, "  y = ", y, "  z = ", z] works, I want
> to automate this for any list.
> 
> Thanks.
> 
> Bruce


  • Prev by Date: Re: How does one export a DXF file with PolygonsOnly set to true?
  • Next by Date: Re: how to read this data file in mathematica?
  • Previous by thread: Re: Printing Variables and Their Values
  • Next by thread: RE: Printing Variables and Their Values