MathGroup Archive 2007

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

Search the Archive

What determines what is assigned to Out[]?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80285] What determines what is assigned to Out[]?
  • From: "Andrew Moylan" <andrew.j.moylan at gmail.com>
  • Date: Thu, 16 Aug 2007 07:20:45 -0400 (EDT)

All of the following result in % returning 1:

1;

x = 1;

x = 1; x = Null;

Module[{}, x = 1;]

I am starting to see a pattern here. Can anyone explain the exact rule that
determines what gets assigned to the Out[] variable?

This is important because, for example, compare the following fairly
equivalent pieces of code:

Module[{}, m = RandomReal[1, 10000000]; flag = 1;]

Module[{}, flag = 1; m = RandomReal[1, 10000000];]

The former assigns 1 to Out[], whereas the latter assigns a roughly 80MB
lump of random reals to Out[]!



  • Prev by Date: Re: Evaluating a convolution integral in Mathematica
  • Next by Date: Re: Unexpected errors when searching documentation for ``
  • Previous by thread: Re: Using Intermediate Variables in DynamicModules
  • Next by thread: Re: What determines what is assigned to Out[]?