Syntax Error
Any number of miscellaneous errors that were not identified by more specific error messages has occurred.
Examples
An omitted closing parenthesis:
.
end if
An incorrect Dim statement:
Dim f //omitting 'as' and data type
Dim As Boolean //no variable name
Dim Double as Double //'Double' is a reserved word
Dim a b as Integer //should be 'a,b'
Dim c as //type missing
Dim myFlag as True //illegal type and use of reserved word
The 'Then' keyword is missing from an If statement:
The Elseif statement was not preceded by an If statement.
// do something
elseif j>0 then
//do something else
end if
//Correct
If j=0 then
.
Elseif j>0 then
.
End if
The End If keyword is missing from an If statement:
#else used instead of Else with a #If statement (conditional compilation).
#If TargetMacOS then
b= SelectColor( c ,"Select a Color")
else // should be #else
Beep
#EndIf
The Next keyword is missing from a For loop:
Dim aInts(2,2) as Integer
For i=0 to 2
For j=0 to 2
aInts(i,j)=i*j
Next
//final 'Next' missing here
One too many Next keywords are used in this example:
Dim aInts(2,2) As Integer
For i=0 to 2
For j=0 to 2
aInts(i,j)=i*j
Next
Next
Next //too many "nexts"
Omitting the Wend keyword from a While loop:
Beep
Next //should be Wend
Dim i as Integer
i=1
//While statement missing here
Beep
i=i+1
Wend
Omitting the While statement:
The Loop keyword is missing from a Do statement:
A Loop keyword was used without a preceding (matching) Do statement
The End Select keyword is missing from a Select Case statement:
case 1
MsgBox "The party of the first part."
case 2
MsgBox "The party of the second part."
//no matching End Select statement
The Select Case statement is missing:
case 1 //Select Case statement missing
Day = "Monday"
case 2
Day = "Tuesday"
end select
The Sub and Function statements cannot appear inside a method.
A comma indicates that the second, required parameter is missing:
Using an equals sign when it is not necessary.
A keyword was misspelled
:
A space rather than a comma is used to separate variable names in a Dim statement: