Authored by Nonki Takahashi
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
EndIf
EndFor
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
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.
Use cond = "False" to exit While loop.
The third one is IndentByIDE .
Follow the IDE about the indentation rules (use [Format Program] below).
Some of these patterns may become snippets for Small Basic.
Happy coding with Small Basic!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.