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