ok, crashcourse on indenting:
Commands like For-Next, Repeat-Until, Select-Case-EndSelect etc. define a certain 'area' in which something happens or gets chosen. This area is usually a number of lines in size, sometimes truly a huge area. This area is called a 'scope'.
For readability, one is suggested to indent a scope so that one can easily see where a scope starts and ends. A lot of bugs can be prevented this way.
So, like this:
Where 'For a' starts is the scope of the 'For b' instruction, where "Debuglog a" starts is the scope of the "If a=4" instruction.
Put a scope-end command (Next, EndIf, Wend, Until, End Function, End Select etc.) straigt under a scope-start command.
So, to see how that works out in my example:
I suggest using the TAB key for indenting, and a TAB size of 4 characters is kind of a universal standard.
In addition to indenting, also make a habit of placing white lines, also for readability (it won't change the functionality of your program, nor does indenting do so).
Where and how you add a whiteline is open for debate, try to see certain commands as part of a group. You want to divide groups with whitelines.
Commands like For-Next, Repeat-Until, Select-Case-EndSelect etc. define a certain 'area' in which something happens or gets chosen. This area is usually a number of lines in size, sometimes truly a huge area. This area is called a 'scope'.
For readability, one is suggested to indent a scope so that one can easily see where a scope starts and ends. A lot of bugs can be prevented this way.
So, like this:
For b=0 To 7 For a=0 To 9 If a=4 DebugLog a If b=3 DebugLog b Endif Endif Next Next
Where 'For a' starts is the scope of the 'For b' instruction, where "Debuglog a" starts is the scope of the "If a=4" instruction.
Put a scope-end command (Next, EndIf, Wend, Until, End Function, End Select etc.) straigt under a scope-start command.
So, to see how that works out in my example:
For b=0 To 7 : For a=0 To 9 : . If a=4 : . : DebugLog a : . : If b=3 : . : . DebugLog b : . : Endif : . Endif : Next Next
I suggest using the TAB key for indenting, and a TAB size of 4 characters is kind of a universal standard.
In addition to indenting, also make a habit of placing white lines, also for readability (it won't change the functionality of your program, nor does indenting do so).
For b=0 To 7 For a=0 To 9 If a=4 DebugLog a If b=3 DebugLog b Endif Endif Next Next
Where and how you add a whiteline is open for debate, try to see certain commands as part of a group. You want to divide groups with whitelines.