Keep the operators, which open and close the block, on one screen. If it's impossible then refactor (extract) the block into a brand new function.
A code block is a fragment, placed between opening and closing operators. These operators are (in different languages):
1. Special code block delimiters: braces ({ and }) in C-like languages and BEGIN/END in PL/SQL and Transact-SQL. 2. Code branching operators (like IF ... ELSE ... END IF). 3. Looping operators (FOR ... NEXT, LOOP ... END LOOP, DO ... WHILE etc.)
That solution will also decrease the . For example, the fragment