[Lazarus] clarification / Re: constant-highlight ? [Re: quick opinion poll / pascal highlighting "case"]
Michael Schnell
mschnell at lumino.de
Fri May 28 09:42:37 CEST 2010
On 05/27/2010 09:25 PM, waldo kitty wrote:
> On 5/26/2010 14:26, Vannus wrote:
>> IMO thats redundant lines + more scrolling to read the code. whereas:-
>>
>> if x then begin
>> code
>> end else begin
>> if y then begin
>> code
>> end else begin
>> code
>> end;
>> end;
>>
>
> the above format hurts my eyes... i cannot see else, for one thing,
> and cannot separate out the individual code blocks...
That is why I love half-indentation:
. + two spaces after a "begin", unless the line begins with an "end"
. - two spaces before a line that is just "end;"
. - one space for the line "end else begin"
. + one space after that line
This clearly shows the "if" (or "while" or whatever) block structure, as
the "if" (or whatever keyword) that starts the line that ends with a
"begin" is at the same column as the final corresponding "end". Moreover
the "else" can easily be found as it is "half unindented" regarding the
"if" block.
The downside is that more indentation space is necessary versus
indenting just a single space. But for readability, too deep structures
should be avoided (by calling a procedure) anyway.
-Michael
More information about the Lazarus
mailing list