OFFTOPalso Lazarus has a convenient "highlight" feature, just select the loop variable name and it will highlight it in the remaining code; note that the latter won't work too well if the loop variable name is short like "i" as highlighting doesn't have "words only" checkbox (or I couldn't find it) and hence will highlight all "i"s in all words on the screen, making it harder to read).
Go to
IDE Options > Editor > Display > Markup and Matches and pay attention to the option "
Match whole words, if length is less or equal to:". You can simply enter a large value like 100, then when you place the cursor in any word, only other whole words will be highlighted. But when you select text, only the selected part will still be highlighted.
Alternatively, you can use custom syntax highlighting in
IDE Options > Editor > Display > User defined markup. You can check the help to learn how to use it - there you can also configure part of a word or whole words. I often use it during refactoring, when I need to highlight certain variables in the code. I also highlight the variables
i and
j in different colors, so as not to confuse them (helps with errors in nested loops).
for i := 0 to 10 do ;
I didn’t notice the semicolon after the “do”
I have previously requested that the code tools not put semicolon after the “do” But to no avail.
As
MarkMLl hinted, this is configurable. The option is in
IDE Options > CodeTools > Identifier Completion, checkbox "
Add semicolon".
In some cases, this option really does more harm than good. See related issue
#37818.