开发者

Coldfusion Control Structures: Which IF does the else go to?

In Java, the else statement goes to the closetest If statement.

so if you have a nested if statement:

if (expression) {

if(secExpression) {

}
else {
// goes with second expression
}
}

The else goes with the second if nested inside.

Where does the else go to in the Coldfusion control structure?

开发者_StackOverflow中文版<cfif expression> 
   <cfif secExpression> 
   </cfif>
   <cfelse>
</cfif> 


The nested-tag syntax makes it unambiguous: The <cfelse> has to be inside of the <cfif ...> ... </cfif> tag, so in your example the <cfelse> can only be related to the outer <cfif>.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜