• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Step 5. Using Forms with ColdFusion MX > Using the IsDefined() Function

Using the IsDefined() Function

As you progress with your ColdFusion coding, you will find that it is very handy to be able to check for the existence of a variable and then perform one action if it does exist and another if it does not. As we have already seen in Step 4, “Controlling Program Flow,” we can use IF statements to take care of the conditional processing. We just need a way to check for the existence of the variable.

The IsDefined() function fits the bill just perfectly. It determines whether or not a specified variable exists (is defined). If the specified variable does exist, the function returns a value of TRUE; if it does not exist, the function (not surprisingly) returns a value of FALSE. The function only takes one parameter, and that is the name of the variable for which we want to check.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint