MathGroup Archive 2009

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

Search the Archive

Re: print variable name and its value


Karsten,

Try SymbolName

Cheers -- Sjoerd

On May 20, 11:36 am, "Karsten W." <Karsten.G.Wein... at googlemail.com>
wrote:
> 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: print variable name and its value
  • Next by Date: Re: Wolfram|Alpha Lookup Tool for Mathematica
  • Previous by thread: Re: print variable name and its value
  • Next by thread: Re: print variable name and its value