[fpc-devel] Fwd: While - Otherwise Statement

Martin Frb lazarus at mfriebe.de
Tue Oct 13 21:20:41 CEST 2015


wkitty42 at windstream.net wrote:
>> ahhhh... my bad... sorry 'bout that... i've been thinking about this, 
>> too... 'else' and 'otherwise' mean the same thing... what they seem 
>> to be looking for is 'aswell'...
>>
>>
>> foo := 0;
>> while foo < 100 do
>>   begin
>>     inc(foo);
>>   end;
>> aswell
>>   begin
>>     dec(foo);
>>   end;
>>
>>
>> either 'aswell' or 'aswellas'... while foo is less than 100 increment 
>> foo as well as decrement foo when it is no longer less than 100...
>

I am not native English, but aswell to me implies "do both" and gives no 
order.
So I would expect this (the aswell block) to be executed for each 
iteration too. like the perl continue block 
http://perldoc.perl.org/functions/continue.html

btw, while I am not for it, the continue block appears much more useful 
than the "on-none-break" block. Though the continue block is not really 
ever needed, usually you can write the loop with the counter decrement 
at the top.

But the existence of such a continue block shows the fundamental issue 
on which a decision is needed. should (if a volunteer for a patch 
exists) every little "save one statement in your code helper" be added? 
Because there are thousands of them, and if you add them all the 
readability of code will go down, because you need to first learn them all.



More information about the fpc-devel mailing list