Message Boards Message Boards


Counterintuitive behavior of Remove function

Posted 10 years ago
1 Reply
2 Total Likes
The sequence of commands entered in one cell in the Mathematica ( shell returns 1 but does not assigns any value to x:
Remove[x]; x = 1
I wonder if it is a feature which serves some purpose; a bug and Wolfram is going to fix it; or a bug and Wolfram doesn't care about it.
POSTED BY: Dmitry Podkopaev
It's a feature:
In[1]:= Remove[x]; x

Out[1]= \!\(
RowBox[{"Removed", "[", "\<\"x\"\>", "]"}],
See the documentation: "If you have an expression that contains a symbol which you remove, the removed symbol will be printed as Removed["name"], where its name is given in a string."
It's because you've removed the symbol from the variable list before the expression completed in evaluation.
POSTED BY: Patrick Stevens
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract