Home > Community > Forums > Custom IC SKILL > Checking existance passed variables

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: *

 Checking existance passed variables 

Last post Wed, Sep 30 2009 1:29 PM by Andrew Beckett. 2 replies.
Started by markbeck 30 Sep 2009 12:34 PM. Topic has 2 replies and 882 views
Page 1 of 1 (3 items)
Sort Posts:
  • Wed, Sep 30 2009 12:34 PM

    • markbeck
    • Top 150 Contributor
    • Joined on Thu, Jun 30 2011
    • Beaverton, OR
    • Posts 45
    • Points 1,355
    Checking existance passed variables Reply

    If I have a procedure:

    procedure( foo( @key (x1 nil) )
    ....
    )

    And inside it I want to check to see if the key x1 was ever passed in, how would I do that?

    I would want the behavior of: 

    foo() 

    to be different than

    foo(?x1 nil)

    So what I need to check is whether x1 was passed in, not whether x1 == nil.

    Any ideas?

    Mark

    • Post Points: 20
  • Wed, Sep 30 2009 1:06 PM

    • markbeck
    • Top 150 Contributor
    • Joined on Thu, Jun 30 2011
    • Beaverton, OR
    • Posts 45
    • Points 1,355
    Re: Checking existance passed variables Reply

     A local skill guru helped me out.

     To check the existance of a variable being passed in, you just need to specify the variable as 'unbound and use a boundp check internally.

     e.g.

    procedure( foo( @key (x1 'unbound))
       if(boundp(x1) then
       ....
       ); if
    ) ; procedure

     

    • Post Points: 5
  • Wed, Sep 30 2009 1:29 PM

    Re: Checking existance passed variables Reply
    One way is to do:

    procedure( foo( @key (x1 'unbound) )
    when(boundp('x1)
    ; it was passed in
    ...
    )
    )

    Regards,

    Andrew
    • Post Points: 5
Page 1 of 1 (3 items)
Sort Posts:
Started by markbeck at 30 Sep 2009 12:34 PM. Topic has 2 replies.