Re: Optional "then" and "do"
- Posted by Michael J. Sabal <m_sabal at ?ah?o.com> May 16, 2008
- 986 views
Keep in mind, syntax errors (missing and, missing then, missing do) are much easier to find and fix than logic errors (variable being assigned value 1 instead of testing for value 1). This feature should only be allowed by a without header, making then and do still required by default. In other words, if the programs starts,
without thendo
and later you see
if a = 1 b = 2 c = 3 end if
a will be tested, b will be assigned, and c will be assigned. If the intention was to test b, there will be a logic error that won't appear until much later in the execution. On the other hand, if the without thendo statement is missing, this code will immediately terminate before execution with an error that something is missing, pointing directly to this line in the program, and creating an ex.err file. Even though I think it's a hassle to always type then and do, I would much rather be forced to do that knowing that I won't have any logic errors because of a missing and/or/then than have to spend several hours trying to hunt down why my program isn't working the way it's supposed to.