MathGroup Archive 2002

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

Search the Archive

Re: Suppressing Print

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32687] Re: Suppressing Print
  • From: lalu_bhatt at yahoo.com (Bhuvanesh)
  • Date: Wed, 6 Feb 2002 03:41:45 -0500 (EST)
  • References: <a3lgfl$ndu$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

au198295 at hotmail.com (Aaron) wrote:

> Is it possible to suppress Print commands in a function.  I have
> written several functions, most of which have Print commands providing
> feedback during the operation.  A couple of these functions are called
> in loops inside of other functions and I would like to suppress the
> Print functions of these embedded function calls.
> Thanks
> Aaron

Hmm... this is not an elegant solution, but you could redefine Print[x_]:

Unprotect[Print];
Print[x_]:=Null;
Protect[Print];

Now, if you have, say,

f[x_]:=Print[ToString[x]];
f[1]

it won't print anything.

--
Bhuvanesh,
Wolfram Research


  • Prev by Date: Re: About programming Mathematica [Newbie question]
  • Next by Date: Import variable and data
  • Previous by thread: Re: Suppressing Print
  • Next by thread: Writing Chinese in Mathematica