# variable globale in a if condition

Hello,

Sorry for my english and for my new comer in sikuli world ;)
I try to use a globale variable "aa" in main and write this in a def() or more def()
for exemple :

def valvar():
global aa
if (aa==2):
aa =aa + 1
print aa
return
if (aa==4):
print aa
return
if(aa==10):
print aa
sys.exit()
return
else:
aa=aa + 1
return

global aa
aa = 0
bou = 1
while bou(): #loops forever
valvar()

Luc

## Question information

Language:
French Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
Solved:
2016-02-16
Last query:
2016-02-16
 Luc Dounadier (mailprog001) said on 2016-02-16: #1

Work better :
def valvar():
global aa
if (aa==2):
aa =aa + 20
print aa
return
if (aa==4):
aa =aa + 40
print aa
return
else:
return
def valvar2():
global aa
if (aa==8):
aa =aa + 80
print aa
return
if (aa==9):
aa =aa + 90
print aa
return
else:
print aa
return

global aa
aa = 4
bou = 1
while bou: #loops forever
valvar()
valvar2()
bou = bou+1
if (bou==6):
sys.exit()
else:
wait(0)

 Luc Dounadier (mailprog001) said on 2016-02-16: #2

i found myself
cool ;-)