Jump to content

check if variable exists?


Recommended Posts

I'm wondering if there's a way to check whether a variable exists?

I'm trying to test whether command line argument 2 ($CmdLine[2]) exists. If not, assign it a default value.

I suppose I could use StringLeft to get the string length, but I'm hoping there's a better way.

Link to comment
Share on other sites

I'm wondering if there's a way to check whether a variable exists?

I'm trying to test whether command line argument 2 ($CmdLine[2]) exists. If not, assign it a default value.

I suppose I could use StringLeft to get the string length, but I'm hoping there's a better way.

<{POST_SNAPBACK}>

$CmdLine[0] contains the number of elements, or the number of passed arguments. $CmdLine[2] can't exist if [0] < 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...