When a function's visibility is external
, trying to modify the function parameters within that function gives the error:
TypeError: Expression has to be an lvalue.
However, if I change the visibility to anything else, Remix gives no errors.
An example function which causes the error:
function d(uint num) external pure {
num += 2; //<-- This line causes the error
}
But changing the visibility to public
removes the error:
function d(uint num) public pure {
num += 2;
}
Why does external
visibility cause function parameters to not be lvalues?