-
Notifications
You must be signed in to change notification settings - Fork 2
Basics
If statements get too long, you can break them in a convenient place by placing an underscore at the end of the line prior to pressing Enter.
Dim sVeryLongString As String = "This is an example of a very long string that has been " & _
"split into multiple lines to make the code easier to read."Multiple statements can be combined onto a single line, as in the example below. Notice the three variables are all dimensioned on the same line and, within the For statement, iResult is increased by the value of i and the results are printed to the debug window, with both statements on a single line.
Dim i As Long: Dim iMax As Long = 10: Dim iResult As Long
For i = 1 To iMax
iResult = iResult + i: Debug.Print iResult
Next iComments are created by using the single quote character ('). Anything to the right of the single quote will be ignored by the compiler. Large blocks of text can also be commented using the character combination /* at the beginning and */ at the end. Note: the Wiki engine does not recognize multi-line comments so the text in the multi-line comment below does not look like a comment.
/*
This is an example of a comment that spans
multiple lines. Remember to start the block
with slash-star and end it with star-slash.
*/
'The next line of code creates a variable that will be used later
Dim sMyString as String = "Unknown" 'this is a comment at the end of a line of codeElements in twinBASIC, such as Forms, Subroutines, Functions, Variables, etc. can be named almost anything that makes sense to the developers. However, there are a few rules that must be followed:
- Elements must begin with a letter or an underscore
- Elements must not include the punctuation characters, ! (exclamation point), # (pound sign), % (percent), $ (dollar sign), & (ampersand), @ (at), or . (period).
- Elements must be no longer than 255 characters
- Elements must not be identical to a reserved keyword.