You can't dynamically create variables. Neither locals, nor globals, nor arrays.
So you know how big an array is or if a variable exists when you look at your script. ;)
If you mean by "exists" if there is a value stored in this variable, you should compare it to "null" or "0" for integers and reals.
If your talking Galaxy code (if so you should place this thread in the Galaxy forum), then putting in an if statement:
if (var != [default value])
is just checking if a variable is instantiated yet. If a variable truly doesn't exist (hasn't been declared) then you will get an error every time. No way around this.
If you're talking the GUI, then you can't even use a variable if it doesn't exist. You don't even get the option.
So when you say exists, do you mean has been declared or instantiated?
Is there any (clean) way to check if a variabele exists?
Thanks in advance!
You can't dynamically create variables. Neither locals, nor globals, nor arrays.
So you know how big an array is or if a variable exists when you look at your script. ;)
If you mean by "exists" if there is a value stored in this variable, you should compare it to "null" or "0" for integers and reals.
@DisAs7ro: Go
If your talking Galaxy code (if so you should place this thread in the Galaxy forum), then putting in an if statement:
if (var != [default value])
is just checking if a variable is instantiated yet. If a variable truly doesn't exist (hasn't been declared) then you will get an error every time. No way around this.
If you're talking the GUI, then you can't even use a variable if it doesn't exist. You don't even get the option.
So when you say exists, do you mean has been declared or instantiated?