Skip to main content

scoping - Module and Manipulate: Why the Red Highlighting?



If I define a function that returns a Manipulate object, and the Manipulate has a local variable inside of it, the local variable is highlighted in red. Here's an example of what I mean:


MyTrigDemo[f_] := Module[{plot},
plot[A_] :=
Plot[A Sin[2 \[Pi] f x], {x, 0, 1}, PlotRange -> {-3, 3}];
Manipulate[plot[A], {A, 0, 2}]
]


displays as (v10.0.0.0)


enter image description here


Despite the scary highlighting, the function seems to work as I expect. Is this structure inadvisable for some reason?




Comments