... with the following message: IsDe...">

ColdFusion structkey starting with number

Why it fails:

<CFIF isdefined("URL.3dfile")>...</CFIF>


with the following message:

IsDefined parameter 1, which is now URL.3dfile, must be a syntactically valid variable name.

and it won't:

<CFIF structkeyexists(URL,"3dfile")>...</CFIF>


Is the way he is sorting out not much? And .. are variables that start with invalid numbers or are they not?


source to share

1 answer

Seybsen - Variable names must not start with a number. This is probably a legacy of an older non-Java version where the variable was not part of the object.

However, in the java world, everything is an object. This leads to a syntactic nuance. If you use dot notation variable names, your var name will most likely throw an error. But use it in other ways and it will be successful.

So this syntax works   url['33foo']

But setting the variable name directly - 33foo = true

- won't work.

Here is a post with a full explanation.




All Articles