22.08.2013 Views

ColdFusion Developer's Guide

ColdFusion Developer's Guide

ColdFusion Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Beta Beta Beta Beta Beta Beta Beta Beta Beta Beta<br />

Nested number signs<br />

In a few cases, you can nest number signs in an expression. The following example uses nested<br />

number signs:<br />

<br />

In this example, number signs are nested so that the values of the variables FirstName and<br />

LastName are inserted in the string whose length the Len function calculates.<br />

Nested number signs imply a complex expression that can typically be written more clearly<br />

and efficiently without the nesting. For example, you can rewrite the preceding code example<br />

without the nested number signs, as follows:<br />

<br />

The following achieves the same results and can further improve readability:<br />

<br />

<br />

A common mistake is to put number signs around the arguments of functions, as in:<br />

<br />

<br />

<br />

These statements result in errors. As a general rule, never put number signs around function<br />

arguments.<br />

Using number signs in expressions<br />

Use number signs in expressions only when necessary, because unneeded number signs reduce<br />

clarity and can increase processing time. The following example shows the preferred method<br />

for referencing variables:<br />

<br />

In contrast, the following example uses number signs unnecessarily and is less efficient than<br />

the previous statement:<br />

<br />

Using number signs 95

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!