A constant cannot be the result of a function since that result could change. Similarly you can't declare a constant and then set its value in another routine.
You can either use a variable - which I assume is what you meant with your second option - or use a function that returns the value you want. You can then simply use that function name as you would the constant.
|