Syntax

From Xojo Documentation

Error message

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


Sample Code

An omitted closing parenthesis:

If (d > 0 Then
.
End If

An incorrect Dim statement:

Var d Double // omitting 'as'
Var f // omitting 'as' and data type
Var As Boolean // no variable name
Var Double As Double // 'Double' is a reserved word
Var a b As Integer // should be 'a,b'
Var c As // type missing
Var myFlag As True // illegal type and use of reserved word

The 'Then' keyword is missing from an If statement:

Var a As Integer
a = 5
If a > 0 // needs to be If a > 0 Then
MessageBox("Boo")
End If

The ElseIf statement was not preceded by an If statement.

Var 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:

Var dayNum As Integer
If dayNum = 1 Then
MessageBox("It's Monday")
// end if needed

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

Var c As Color
#If TargetMacOS Then
b = Color.SelectedFromDialog(c, "Select a Color")
Else // should be #else
Beep
#EndIf

The Next keyword is missing from a For loop:

Var I, j As Integer
Var 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:

Var i, j As Integer
Var 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

Omitting the While statement:

Var i As Integer
i = 1
// While statement missing here
Beep
i = i + 1
Wend

The Loop keyword is missing from a Do statement:

Var 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

Var 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
MessageBox("The party of the first part.")
Case 2
MessageBox("The party of the second part.")
// no matching End Select statement

The Select Case statement is missing:

Var 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.AddRowAt(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
MessageBox("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:

Var a b As Integer // should be 'a,b'