A few general questions on scope of variables

1)Is there a way to declare a variable (say, x) to be treated as real during your Mathematica session in entire notebook?

  1. The command Clear[symbol,…] clears Global variables or not? If not is it a way to clear all variables (Global as well)

  2. Is there a command to clear all variables without naming them?

Many thanks

JME

  1. Some functions accept Assumptions, for those cases you could add to $Assumptions something like Element[x, Reals].

  2. You can try it out:

fdfasda

x = 3
ff[a_] := Module[{},
  Clear[x];
  Print[a]
  ]
ff[1]
x

So yes, it does. I’m not sure how this interacts with namespaces, but can surely be found here: guide/NamespaceManagement

  1. You could use Clear or ClearAll

To do something like:

ClearAll[Evaluate[Context[] <> "*"]]