[fpc-devel] Fwd: While - Otherwise Statement

Michael Van Canneyt michael at freepascal.org
Mon Oct 12 19:18:42 CEST 2015



On Mon, 12 Oct 2015, Max Nazhalov wrote:

>
> On 12.10.2015 17:17 schrieb "Dmitry Boyarintsev" <skalogryz.lists at gmail.com> wrote:
>> About while-then. While the syntax is unlikely to break anything, it's
>> inconsistent with if-statement.
>> where, if-then is executed when condition is true.
>> For while-then is executed then condition is false.
>> Thus, while-else or while-otherwise are better. However, both syntax would
>> cause code incompatibility.
>
> I doubt "while-else" is a variant, due to dangling "else".
>
> How will be compiled, e.g.
> if something then
>  while not_done_yet do
>    the_work
> else // obviously valid, and expected to be a part of "if-then-else"
>  something_else_happened;

That is the meaning of "However, both syntax would cause code incompatibility."
and is already in my very first reply to OP.

So While... else or While .. Otherwise will never make it in the compiler.

Michael.



More information about the fpc-devel mailing list