MathGroup Archive 2009

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

Search the Archive

print variable name and its value

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99979] print variable name and its value
  • From: "Karsten W." <Karsten.G.Weinert at googlemail.com>
  • Date: Wed, 20 May 2009 05:38:17 -0400 (EDT)

Hello,

how can I dump out a variable with its value? The following does not
work:

myVar1 = 1;
myVar2 = 2;
DumpVars[list_List] :=
  MapThread[(Print[#1, ": ", #2]) &, {Map[ToString[#] &,
     Unevaluated[list]], list}];

DumpVar[var_] := Print[ToString[Unevaluated[var]], ":", var];


DumpVars[{myVar1, myVar2}]
DumpVar[myVar1]

Any ideas?

Kind regards,
Karsten.


  • Prev by Date: Re: How Long?
  • Next by Date: 100000 messages to MathGroup and a rose to the Moderator
  • Previous by thread: Re: Customise a Mathematica 7.0 Palette for braces and square
  • Next by thread: Re: print variable name and its value