Know a text editor have feature colorizing the loop?

Sorry if not really right place for this:

Is there any S/W development text editor have feature colorizing every part that is of iteration or loop process ?
Many code editors/IDEs have a feature that will highlight pairs of { } when placing the text cursor next to one of them. This can help you see what code belongs to loops and other block scopes, but otherwise you'll go a long way with just proper indentation.
Last edited on
Additionally, most editors will highlight matching “words” when you place the text caret on a word. For example,

1
2
3
4
 for (int n = 0;  n < 10;  n++) 
 {
   std::cout << n << "\n"; 
 }

If you place the text cursor on any n, the editor will highlight all the other ns.

I personally like Notepad++, but it is a Windows program, you need to run it with Wine.

Another good choice is Sublime Text.
Last edited on
I'm not sure that you will find any editor that directly colourises a loop structure. What would it do if you had nested loops?

Highlighting matches braces is useful, and also helps with scope. But "loop" covers many flow-control routes, many not trivial: e.g. exiting them with break or return, recursion, or when (heaven forbid) someone is using goto to create an implicit loop structure.

Get used to using good indentation. (Actually, I quite like python's reliance on it for establishing good practice.)
Last edited on
you can sort of force it with notepad++ and your own language, but nesting would be frustrating.

you can also perhaps practice your own form of defensive coding, eg I have been known to do this to improve readability if my code gets complicated:

1
2
3
4
5
6
7
8
9
10
11
for(int i...)
{
   for(int j...)
   {
      for(int k..)
        {

        }//end for k
   }//end for j
}//end for i


your IDE should tie pairs together, and indentation should make it clear, but even so, running across a random } while browsing it really helps to have a what is this comment for long blocks.
Last edited on
Many modern IDEs have "folding" options and will show the beginning and end of the loop structure along the left side of the window... This works even with nested structures.
Topic archived. No new replies allowed.