How to exit a function?

I have a question, how do I exit a method (function)?

For example:

to myMethod
if (condition 1)
exit myMethod
end if
Statement 1
end myMethod

In eggPlant/Sensetalk, how do I exit myMethod so the code following it won't be executed?

Thanks

Comments

  • MCSVZW,

    The script that you have copied in should actually work, because "exit myMethod" is a valid way to exit the function. You can also look at the section on Exiting a Handler in the SenseTalk Reference manual.

    Another way to exit a function is to use "Return":
    to myMethod
    if (condition 1)
    Return
    end if
    Statement 1
    end myMethod
    

    -Elizabeth
Sign In or Register to comment.