Quantcast
Channel: LiveCode Forums
Viewing all articles
Browse latest Browse all 780

Talking LiveCode • Pesky semiColons?

$
0
0
Should have put this in the beginners section. Am I the only one on the planet who just now discovered that, given:

CODE:

if this then   XYZelse doThis ; doThat
is NOT the same as:

CODE:

if this then   XYZelse   doThis   doThatend if
In the first snippet, only "do this" is bound by the "else" clause. "doThat" will execute no matter what, the same as if one placed that it on its very own line below the entirety of the if/then construct.

The semiColon seems to be a convenience for looking at lines of code, but it actually is two very independent lines. If such a line follows "else", it will not be part of that "else".

Craig

Statistics: Posted by dunbarx — Fri May 31, 2024 4:02 pm



Viewing all articles
Browse latest Browse all 780

Trending Articles