Skip to main content
2 of 2
deleted 62 characters in body
Mr.Wizard
  • 275.2k
  • 34
  • 606
  • 1.5k

In your code you have a Symbol s that is not declared before the line Begin line. Because of this it is created in that specified Afak10`Private` context. (Also, your code presently has an error; it needs to be Begin["Private`"].) You can include the Global` context if that is in fact the Symbol you wish to return:

f[x_] := Module[{}, x^2 + Global`s]; (* as part of your package *) 

Now using the function:

f[z] 
s + z^2 

Nevertheless I caution you about this method as you generally should not use (plain) global Symbols like this; instead use Formal Symbols which are Protected to prevent accidental assignment.

f[x_] := Module[{}, x^2 + \[FormalS]]; 

It looks like this:

enter image description here

Mr.Wizard
  • 275.2k
  • 34
  • 606
  • 1.5k