if without endif while without wend 等は、何もプログラムがない行に エラーが起きます。 WENDや、ENDIFがどこかで 抜けているのが原因です。