The keyword 'Then' is expected after this If statement's condition

From Xojo Documentation

Error message

You neglected to type the 'Then" keyword after the Boolean condition in an If statement. To eliminate the possibility of this error, type Shift+Enter after typing

If condition

  The Code Editor will then add the "Then" after the condition, add the End If statement and place the cursor in between the two.

Another shortcut is to write only the statements that meet the condition (inside the If...End if), select them, and then choose Wrap in If...End If from the Code Editor contextual menu. This will surround your statements with IF condition Then above and End If below.

Examples

If error=-123 //needs a 'Then' right here
Beep
MessageBox("Whoops! An error occured.")
End If


See Also

If statement.