Hello, I am working on an application where user inputs some values/function. For some cases I need to change the value internally. But I get an error cannot assign to raw object. What is the way around this problem ? I am sure there is but I just could not find one. ( I am aware that n there is not really n it is a number. That is why I can't do 8=10. )
Here is an simple mini-code
Get[FileNameJoin[{NotebookDirectory[EvaluationNotebook[]],
"Trialpackage.wl"}]];
DynamicModule[{n = 16, R = 32}, Column[{
Row[{Style["Number of Digits", 12, Black],
InputField[Dynamic[n], Number, FieldSize -> 5]}, Spacer[5]],
Button[Style["Calculate", 14, Green, Bold],
R = Trialpackage`dummyfunc[n]],
Row[{Style["Result", 12, Red], InputField[Dynamic[R]]},
Spacer[15]]}],
Initialization :> (
Get[FileNameJoin[{NotebookDirectory[EvaluationNotebook[]],
"Trialpackage.wl"}]]
)
]
and the package is
BeginPackage["Trialpackage`"]
dummyfunc::usage="";
Begin["`Private`"]
dummyfunc[n_]:=Module[{f,b},
f=3;
b=6;
If[n<10,Clear[n]; n=16];
Print[n];
res=n*f*b;
Return[res];]
End[];
SetAttributes[{dummyfunc},{ReadProtected,Protected,Locked}];
EndPackage[];