Illegal single-line IF

A physical end-of-line (with no line-continuation character) appeared before the end of the Then or Else clause in an If...Then...Else statement. For example:

If X = Y Then Do : X = X + 1
Loop              ' Illegal. Loop must appear on same line as Do.

A single-line If...Then...Else statementmust be completely contained on one line, including any continuation lines designated by line-continuation characters.

Do one of the following:

  • Write the Then clause and the Else clause on the same line as the If.
  • Use a line-continuation character.
  • Use an If...Then...Else...End If block statement in place of the single-line If...Then...Else statement.