The example of the "then" you mentioned isn't what Richard meant, I don't think. The OP wrote that correctly. If I'm reading Richard's mind right, this what we mean, and does not occur in this thread:
Oh I see. This shows that my statement "semicolon is equivalent to cr in scripts" is wrong! This should read: Semicolon is equivalent to cr after "complete" statements in scripts. For example a semicolon after "then" is wrong.
Because your example is so short I would write this as
All those weird variants were explicitly offered for sale in HC. Readability be damned. They were fraught with peril, though, and only a few were ultimately considered "acceptable". Some would not indent, though they would compile.Some, that really seemed OK, if nested into other if-then constructions, would not compile unless broken out fully:
if soAndSo then
whatever
else
whateverelse
end if
I never understood why, but learned long ago that if I just expanded, the overall handler would compile and work.
dunbarx wrote:
I never understood why, but learned long ago that if I just expanded, the overall handler would compile and work.
I had a disagreement with XXX at a conference once about that. He wrote all if/else clauses in standard structure no matter how short they were. I do that mostly too but I also use one-liners sometimes if they're short enough. The other structures aren't reliable for the reasons you mention. Mark Waddingham once explained what the rules were for compilation but I've lost the reference, and so I just remember that the safest thing, as you say, is to write them in fully expanded format.
So we're back to standard structures, and all that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jacque wrote:The example of the "then" you mentioned isn't what Richard meant, I don't think. The OP wrote that correctly. If I'm reading Richard's mind right, this what we mean, and does not occur in this thread: