Syntax Error

Any number of miscellaneous errors that were not identified by more specific error messages has occurred.

# Examples

An omitted closing parenthesis:

If (d > 0 then
.
end if

An incorrect Dim statement:

Dim d Double //omitting 'as'
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:

Dim a as Integer
a=5
If a >0 //needs to be If a>0 then
MsgBox "Boo"
end if

The Elseif statement was not preceded by an If statement.

Dim i,j,k as Integer
// 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:

Dim dayNum as Integer
if dayNum=1 then
MsgBox "It's Monday"
// end if needed

#else used instead of Else with a #If statement (conditional compilation).

Dim c as Color
#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 i,j as Integer
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 i,j as Integer
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:

While i<10
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:

Dim i as Integer
Do until i=5
Beep
i=i+1
//missing Loop statement

A Loop keyword was used without a preceding (matching) Do statement

Dim x as Integer
// Do statement missing
x=x+1
Loop Until x<100

The End Select keyword is missing from a Select Case statement:

Select Case x
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:

Dim Day as String
case 1 //Select Case statement missing
Day = "Monday"
case 2
Day = "Tuesday"
end select

The Sub and Function statements cannot appear inside a method.

Sub myMethod(x as Integer,y as Integer)
Sub myMethod (x as Integer,y as Integer)
.

A comma indicates that the second, required parameter is missing:

ListBox1.insertRow 2,

Using an equals sign when it is not necessary.

Return=x*y //equals sign should be a space

## A keyword was misspelled

If dayNum=1 then
MsgBox "It's Monday"
end fi //should be end if

:

A space rather than a comma is used to separate variable names in a Dim statement:

Dim a b as Integer //should be 'a,b'