Home > Community > Forums > PCB SKILL > exit skill function prematurely

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 exit skill function prematurely  

Last post Tue, May 22 2012 6:04 AM by fxffxf. 1 replies.
Started by Adamsen 22 May 2012 05:44 AM. Topic has 1 replies and 2223 views
Page 1 of 1 (2 items)
Sort Posts:
  • Tue, May 22 2012 5:44 AM

    • Adamsen
    • Not Ranked
    • Joined on Tue, May 22 2012
    • Posts 8
    • Points 245
    exit skill function prematurely Reply

    Hello.

    I want to check for a condition and exit my function or program if the condition is not met. In other programming languages I would do this with return or exit statements. But this does not seem to work in skill. 

    Here is an example:
    defun( foobar()

    unless(axlGetVariable("ALLEGRO_BRD2ODB")
      axlUIConfirm("BRD2ODB not found. Please install!")
      exit() ; is not working, what should i use here to exit function?
     ) 
    ;do some other stuff if condition is ok 

    ) ;defun

    if the skill window is open this will close on the exit command.

     

    • Post Points: 20
  • Tue, May 22 2012 6:04 AM

    • fxffxf
    • Top 25 Contributor
    • Joined on Thu, Jul 17 2008
    • ., AK
    • Posts 290
    • Points 4,620
    Re: exit skill function prematurely Reply

    use the return statement

    If you need return multiple levels you will may want to use err/errset which is basically a catch/throw let mechanism. You can read about this in the Skill Language User Guide (look for the section Using err and errset Together.

    • Post Points: 5
Page 1 of 1 (2 items)
Sort Posts:
Started by Adamsen at 22 May 2012 05:44 AM. Topic has 1 replies.