tags:

views:

34

answers:

1

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?

+3  A: 

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
ghostdog74