wrybread Posted July 27, 2005 Share Posted July 27, 2005 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 More sharing options...
seandisanti Posted July 27, 2005 Share Posted July 27, 2005 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 More sharing options...
wrybread Posted July 28, 2005 Author Share Posted July 28, 2005 $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. Link to comment Share on other sites More sharing options...
seandisanti Posted July 28, 2005 Share Posted July 28, 2005 Thank you, very elegant.<{POST_SNAPBACK}>glad i could help Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now