Small Basic – Coding Patterns

I started to organize coding patterns for Small Basic here in CodePlex.  I sometimes use these patterns in my Small Basic programs.

For example, I use three patterns in following code (from WNK213). 

  mcol = 0  ' mouse column
  For col = 1 To 3
    If x1[col] < x And x < x2[col] Then
      mcol = col
      col = 3 ' exit for

I named the first pattern as CamelVar.  I named each pattern.  A pattern has it's name, descriptions, codes, pictures, exceptions, links to other patterns and external links.  This concept is come from Pattern Browser described with HyperCard.


Use camel notation for variable names.

ex. angle, mouseDown


See Also

Other Resources

The second pattern is PseudoExit.  This pattern is alternative for Exit For or Exit While in Visual Basic.  Because Small Basic doesn't have these keywords.


Use i = n to exit For loop.

For i = 1 To n
  If exit Then
    i = n  ' exit for

Use cond = "False" to exit While loop.

While cond
  If exit Then
    cond = "False" ' exit while

The third one is IndentByIDE.


Follow the IDE about the indentation rules (use [Format Program] below).

Screen shot of Small Basic IDE with a popup including Format Program

Some of these patterns may become snippets for Small Basic.

Happy coding with Small Basic!

Other Resources

Comments (1)

Skip to main content