Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 5
    $\begingroup$ Use Extract instead, e.g., Extract[HoldForm[w = 3], {1, 1}, Hold] $\endgroup$ Commented Sep 13, 2018 at 21:25
  • $\begingroup$ @CarlWoll, thanks, this is indeed what I was looking for. But this returns Hold[w]. How do I extract "w" from Hold[w], e.g. for printing it? $\endgroup$ Commented Sep 13, 2018 at 21:56
  • $\begingroup$ Perhaps you could use HoldForm instead of Hold? $\endgroup$ Commented Sep 13, 2018 at 22:00
  • $\begingroup$ Yes. Thanks again! $\endgroup$ Commented Sep 13, 2018 at 22:18
  • 3
    $\begingroup$ w = 4; Hold[ w = 3 ][[ {1}, 1 ]] $\endgroup$ Commented Sep 14, 2018 at 5:57