According to the documentation AppendTo[s,elem]
is equivalent to s = Append[s,elem]
.
But then
y = {}; Plot[y = Append[y, x]; Sin[x], {x, Pi/4, Pi/2}]
works as intended, while
y = {}; Plot[AppendTo[y, x]; Sin[x], {x, Pi/4, Pi/2}]
produces the error message
AppendTo::rvalue: {[Pi]/4} is not a variable with a value, so its value cannot be changed.
Can someone explain what is going on?