After I finished writing the following code snippet

With[{values = {-3, 0.3, -0.03, -0.003, 0.003, 0.03, 0.3, 3}},
    Block[{b = value},
      b t,
      {t, 0, 100},
      PlotLabel -> Row[{HoldForm[b] -> b}]
     ], {value, values}], 3, 3, {1, 1}, {}]]]

I realized that b in HoldForm (at PlotLabel -> Row[{HoldForm[b] -> b}]) was highlighted in red and hovering the cursor on top of it produces a tool tip with the text: "b in HoldForm occurs where it is probably not going to be evaluated before going out of scope".

enter image description here A the end of the tool tiop, there is an info button that, when pressed, opens up the documentation of HoldForm.

Can somebody, please, explain to me why am I getting this behavior?


closed as off-topic by Szabolcs, Henrik Schumacher, Coolwater, m_goldberg, Bob Hanlon Jan 30 '18 at 17:20

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Szabolcs, Henrik Schumacher, Coolwater, Bob Hanlon
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ It means exactly what it says. You gave a temporary value to b, then used b in a context where it won't be evaluated. Minimal example (which you should construct yourself next time): Block[{b = 1}, HoldForm[b]]. This is a warning, not an error. It is up to you to decide whether it is relevant (here it's clearly not). $\endgroup$ – Szabolcs Jan 30 '18 at 9:25
  • 1
    $\begingroup$ Take a look at: mathematica.stackexchange.com/a/633/5478 $\endgroup$ – Kuba Jan 30 '18 at 9:30
  • $\begingroup$ I'm voting to close this question as off-topic because the issued raised is not really a Mathemmatica issue, but a misunderstanding of a warning message by the OP. $\endgroup$ – m_goldberg Jan 30 '18 at 16:15
  • $\begingroup$ The code editor doesn't know anything about semantics. It only knows about syntax. Just ignore the warning. $\endgroup$ – m_goldberg Jan 30 '18 at 16:17
  • $\begingroup$ a workaround (instead of ignoring the error) may be to do bname = HoldForm[b]; before the Block, then do PlotLabel -> Row[{bname -> b}] $\endgroup$ – george2079 Jan 30 '18 at 17:16

Browse other questions tagged or ask your own question.