[?] Declare a local variable?

Hi guys

I would like to declare location variable so it will not be signed on the global here is a simple code ( as image attach)

thank you

You can localize a variable with Module:

local[parameter_] := Module[{localVariable},
  localVariable = parameter*2;
  Return[localVariable]]

No need for Return. In your special case you can achieve the same output with simpler inputs:

local[parameter_] := Module[{localVariable},
  localVariable = parameter*2;
  localVariable]
local[parameter_] := Module[{localVariable},
  localVariable = parameter*2]
local[parameter_] := parameter*2

See Module and friends. More in:

https://mathematica.stackexchange.com/q/559/5478