Sign in to follow this  
Followers 0
wrybread

check if variable exists?

4 posts in this topic

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.

Share this post


Link to post
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

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

$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.

Share this post


Link to post
Share on other sites

Thank you, very elegant.

<{POST_SNAPBACK}>

glad i could help

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
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
Sign in to follow this  
Followers 0