Start Back Next End
  
ZBasic Language Reference
45
ZBasic Microcontrollers
Examples
Bx0100_1101
BX01_00_11_01
2.7 Comments
Comments may be placed on a line by themselves or at the end of a line containing other program text. 
A comment begins with an apostrophe and continues to the end of the line.  A comment may be
continued on the next line in the manner described in Section 2.8.
Note: The BasicX compiler does not allow comments to be continued but Visual Basic does.  ZBasic
allows comment continuation both in native mode and in BasicX compatibility mode.
Examples
'This is a comment.
a = 23    ' this is a comment, too
b = 55    ' and because this comment ends with an underscore _
it continues on the next line
2.8 Line Continuation and Multiple Statements Per Line
A statement may continued across multiple lines by ending each line except that last with an underscore
preceded by at least one space or tab character.  Except for spaces, tabs and/or a comment, no
characters other than end-of-line characters may follow the underscore for it to be considered a line
continuation character.  The maximum aggregate size of a line, whether continued across multiple lines
or not, is 1000 characters.
In the example below the beginning of the If statement is continued to the following line.  This is often
useful to help make more complex expressions more readable.
Example
If (GetPin(20) = 1) And _
    (GetPin(12) = 0) Then
  Call PutPin(5, 0)
End If
While the line continuation capability allows you to create statements that span multiple lines, it is
sometimes convenient to place multiple statements on one line.  In ZBasic, as in many other Basic
dialects, you may accomplish this by using a colon to separate each pair of statements on the line.
Example
Dim i as Integer
Dim j as Integer, k as Byte
i = 0 : j = 1 : k = 2
Previous page Top Next page