← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #213751]: Anything similar to goto function?

 

Question #213751 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/213751

    Status: Open => Answered

RaiMan proposed the following answer:
--- the static version

reportsToRun = (1,3,5)

for i in reportsToRun:
    if i == 1:
        # run 1-Report A
    elif i == 2:
        # run 2-Report B
    elif i == 3:
        # run 3-Report C
    elif i == 4:
        # run 4-Report D
    elif i == 5:
        # run 5-Report E

--- the dynamic version
put every different section in a def() using a naming scheme like

def report1():
    # here your coding for report 1 (indented 1 level!)

def report2():
    # here your coding for report 2 (indented 1 level!)

.... and more

reportsToRun = (1,3,5)

for i in reportsToRun:
    eval("report"+str(i)+"()")

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.