MathGroup Archive 2004

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

Search the Archive

Re: Printing Variables and Their Values


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