is there any way to auto-indent?

BlitzMax Forums/BlitzMax Beginners Area/is there any way to auto-indent?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Basically, increase the indent whenever you use the following commands and outdent again when you use their counterpart.

Function .. EndFunction
Repeat .. Until/Forever
While .. Wend
For .. Next
Type .. EndType
Method .. EndMethod

Select is a bit funny, but it should look something like this...

Select <variable>
    Case <value1)
        ' do stuff
    Case <value2>
        ' do something else
    Default
        ' otherwise do this instead
EndSelect


If..Then..ElseIf..EndIf is another funny one...

If <expression> Then
    ' do this
ElseIf <expression2> Then
    ' do that
Else
    ' do something else
EndIf


Don't forget that these can all be nested...

Function CheckCollisions()
    For b:bullet=EachIn bulletList
        For a:alien=EachIn alienList
            If <bullet hits alien> Then
                 score:+100
                 alienList.Remove(a)
                 a=Null
                 bulletList.Remove(b)
                 b=Null
                 Exit
            EndIf
        Next
    Next
    FlushMem
EndFunction

Notice that all the For's and If's line up with their respective Next's and EndIf's.

Hope that helps