LotusScript indentation doesn't work if code contains 'end' statements

When a LotusScript in a script library contains an end statement, correcting the indentation (via the menu or by using CTRL+I) does not correctly indent.

Consider this small example:

Sub Initialize()

If 1 > 2 Then

End

Else

If 1 = 2 Then

	Print "1=2"

End

Else

Print "ok"

End If

Print "ok"

End If

End Sub

After an “End” statement, the next line outdents to the most outside level, which is very confusing and make it completely unreadable, especially for larger scripts with nested if-statements.

Subject: why not Exit Sub?

Subject: because the whole script has to end, not just the sub

End and Exit Sub don’t have the same results. Where Exit Sub will just stop executing the current sub and continue the calling routine, End will completely abort the main routine.