Question about Python/UserTalk style indentation.
I've attempted to adapt a "Python/UserTalk" style of indentation when working with all languages. In PHP I'll indent the trailing curly bracket along with the rest of the block of code like so:if(!emailValid($attributes['email'])){ raiseError("Please enter a valid email address"); }
In tag based languages, I've tried the same approach. I have one question. How do I handle an "else" block of code? Should the "else" statement be at the same level as the original "if"? I've been doing it that way. With ColdFusion it makes for some un-even diagonal lines when backing out of the indented blocks.<cfif press.recordCount gt 0> <cfoutput query="press"> <p><a href="index.cfm?fuseaction=one_press&content_id=#content_id#">#title#</a><br> #summary#</p> </cfoutput> <cfelse> <p>There are currently no press stories.</p> </cfif>
See the jump from the closing "cfoutput" to the "cfelse" tag? Is that correct? It bothers me. I know I have much more interesting things to worry about if I'm still using ColdFusion (ha ha), but seriously I would love to get some thoughts on the issue from people who have an opinion.
9:23:54 PM comment [] Google It!
|