sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #08874
Re: [Question #188360]: Cant use def!?!?
Question #188360 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/188360
Status: Open => Answered
RaiMan proposed the following answer:
Uuups, you should have a look at lists and loops - makes code much
shorter and more flexible ;-)
You only said, that noore is global. But nowhere it is getting a value
like noore=1.
BTW: declaring a variable as global is only needed inside a def if you
change its contents inside the def
x = 1 # x is global
def func():
print x # x is still global
def func1():
x = 5 # this x is local to the def
print x
def func2():
global x
x = 2
print x
print x # 1
func() # 1
print x # 1
func1() # 5
print x # 1
func2() # 2
print x # 2
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.