# Re: [sage-support] Global variable in Boolean function

```On Tue, Feb 13, 2018 at 1:46 AM,  <santu....@niser.ac.in> wrote:
> Input:
> B.<l0,l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16,l17,l18,l19,l20,b>
> = BooleanPolynomialRing(order='lex')
> l15=b+b
> print "l15:",l15
> def fun():
>            print "l15:",l15
>```
```
I don't get this in 7.6. Instead, I get the expected behavior:

sage:
B.<l0,l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16,l17,l18,l19,l20,b>
= BooleanPolynomialRing(order='lex')

....: l15=b+b

....: print "l15:",l15

....: def fun():

....:            return "l15:",l15

....:

l15: 0

> output:
>
> l15: 0
> l15:
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "_sage_input_13.py", line 10, in <module>
>     exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8
> -*-\\n" +
> _support_.preparse_worksheet_cell(base64.b64decode("cHJpbnQgImw2MzoiLCBsNjMKS1NBKCk="),globals())+"\\n");
> execfile(os.path.abspath("___code___.py"))
>   File "", line 1, in <module>
>   File "/tmp/tmprgCX70/___code___.py", line 3, in <module>
>     exec compile(u'fun()
>   File "", line 1, in <module>
>   File "/tmp/tmpbGAWHq/___code___.py", line 3, in KSA
>     print "l15:", l15
> UnboundLocalError: local variable 'l15' referenced before assignment
>
>
> Input:
> B.<l0,l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16,l17,l18,l19,l20,b>
> = BooleanPolynomialRing(order='lex')
> l15=b+b
> print "l15:",l15
> def fun():
>
> C.<l0,l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16,l17,l18,l19,l20,b>=
> BooleanPolynomialRing(order='lex')
>         print "l15:",l15
> output:
> l15: 0
> l15: l15
>
>
> My question is : how can globally i will declare the value of l15?
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
To post to this group, send email to sage-support@googlegroups.com.