I am using ColdFusion 9.0.1
I recently read that in ColdFusion 9, it is now advised to use isNull() and not use isDefined().
I didn’t find much info on this at all around the web.
Is there any advantage to using one or the other in ColdFusion 9?
I know that in general people have been moving away from it for some time. The main use for it was to determine whether a variable existed in a particular scope, but structKeyExists() is more precise for that. IsDefined() works very hard to find any possible instance of the variable you’ve asked for. (Sean Corfield had a bit to say about structKeyExists vs. isDefined.)
I’ve not seen anywhere a recommendation to use isNull() instead of isDefined. Actually, I would have expected isNull to return an error if you give it an undefined variable, but apparently that works.
How do you do dynamic variables, though?
You can try array notation…
…but if
iis undefined this throws an error.