|
|
names alphanumeric (including _), beginning with a letter. |
generic expressions
(x)
|
numbers (Byte , Integer , Long , Single , Double )
0, 1, -1, ..., &H000000FF&
1.0, 2.0, 1.5, 0.6666, ...
a + b
a - b
- a
a * b
a / b
a ^ b
int = float converts by rounding.
|
sentences (Boolean )
False
True
a = b
a <> b
a < b
a <= b
a >= b
a > b
s And t
s Or t
Not s
|
strings (String )
"whatever"
s + t
|
actions
If <boolean expr> Then
...
End If
If <boolean expr> Then
...
ElseIf <boolean expr> Then
...
Else
...
End If
Select Case name
Case "Kevin": <stmt>
Case "Phil": <stmt>
End Select
End <terminates the program>
Print <expr>
|
procedure definitions
Function functionName(x As Type1) As Type2
action1
action2
functionName = ... x ...;
End Function
Sub subroutineName(x As Type1)
action1
action2
End Sub
|
variables
Dim d As String scope depends on where declared
name = expression
|
modules
base (or global) code module |
Variables persist until end of program.
Global (program-scope) types, variables, and constants may be defined.
Global a As Integer
Contains only code, not events.
.bas extension |
form declaration module | definitions block/section defines variables and procedures local to that form Form modules are allocated storage only while the form is loaded.
When the form is unloaded, the state is lost. |
procedure or event |
defines a local block, visible only to itself |
|
|