Reputation: 93196
I want to define a constant inside a function that could be used outside the function's scope.
function section {
variable = "Hello"
}
echo variable
Is this possible?
Upvotes: 0
Views: 678
Reputation: 342363
its already there for you to use. try to run it and see. Remember, no spaces between "=" sign when assigning variables
$ function section { variable="Hello"; }
$ section
$ echo $variable
Hello
Upvotes: 4