Jump to content

Recommended Posts

Posted

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.

Posted

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
Posted

$CmdLine[0] contains the number of elements, or the number of passed arguments.  $CmdLine[2] can't exist if [0] < 2

<{POST_SNAPBACK}>

Thank you, very elegant.

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
  • Recently Browsing   0 members

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