📜 ⬆️ ⬇️

Reduce the nesting level

Sometimes from outsiders get big procedures, from which there is a big headache.
For example, when I got the kilometer procedure 1C for processing. Overall, she looked like that:

()
(1)
//
//
(2)
= 1 ()
(3)
//
//
(4)
//
//
;
;
;
;
;


It should be noted that the original horror story had about the same levels of nesting, but did not fit on 4 screens. Plus, the tabulation was lame ... to tell the truth, the mood fell below the baseboard when it took to find the boundaries of the blocks "If ... EndIf". Understood with tabulation, procedure was cut down to the following look:

()
( 1)
;
;

//
//

( 2)
;
;

= 1 ()
( 3)
;
;

//
//

(4)
//
//
;
;


At first I wanted to take out the third block of code from the check, but changed my mind. Readability, in my opinion, from this only worsens. As for Condition2 , you can still think. But the first and the third checks, in my opinion, cannot be reduced to a sin.
')
For some reason, the command to exit the procedure (or return to the beginning of the cycle) is still not always and not all welcomed. Even then, when it would be more visible and generally more appropriate than an extra tab until the end of the procedure. And yet, not for nothing that one is good, then the other is death. Maybe I just have such a bad taste.

PS And what, in the <code> block is it already forbidden to tint the text? Sorry, it looked nicer)

Posted on 10/27/2007 8:30 PM
I thought about it and decided that the best option for me was the filter of input conditions and the subsequent nesting, i.e.
()
( 1)
;
;

//
//

(2)
= 1 ()
( 3)
;
;

//
//

(4)
//
//
;
;
;


Upd @ 07.11.07
By the way, in the same Pearl, it seems, the timely suicidality of scripts seems to be quite welcome, if the condition is not met - die "Reason" :-D

Source: https://habr.com/ru/post/15479/


All Articles