Compiler error:ending does not match beginning. Do not see the problem, Do Loop End

Library "Truedial.trc"
Library "TrueCtrl.trc"

Dim Menu$ (2,0:2)
Mat read menu$

Data File, New, Open, @, Exit

Data Help, Help/Info, About

Call TC_Init

Call TC_Win_SetTitle(0,"EEcalcs")

Call TC_Menu_SetCheck(0,2,1,1)

Call TC_Show(0)

Do

Call TC_Event(0, event$,Window,x1,x2)

If event$ = "MENU" then
Let menu = x1
Let item = x2

If menu = 1 then
If item =1 then

Call TD_Message("New Project","Enter the Name, Location, & ID in the Project Box above","OK",1,result)

Elseif Item = 2 then

Call TD_Message("Existing Project","Select Project Name from the List in the Project Box","OK",1,result)
If result =2 then exit do
Elseif Item = 4 then

Elseif Menu = 2 then

If item = 1 then

Call TD_Message("Help/Info","Work In Progress","OK",1,result)

ElseIf item = 2 then

Call TD_Message("About","About - Ten Lines???","OK",1,result)

Loop

END

Comments

Ending doesn't match...

Hi PowerPlot,

You have 4 IF-THEN openings, and 4 ELSE IF's, but not a single END IF. This results is "ENDING DOES NOT MATCH BEGINNING".

The proper formats for these 5 types of structures are shown below. In each case, the xxx=yyy, etc., can be any type of conditional expression, e.g., x=0, y<>0, z<=0, s$<>y$, and so on.

(1) A single condition causes something to happen
IF xxx=yyy THEN
...do something...
END IF

(2) Two conditions, if one is met, do one thing; if the other condition is met, do something else. There can be any number of ELSE IF's as required, but the series MUST end with END IF:

IF zzz=uuu THEN
...do something...
ELSE IF xxx=yyy THEN
...do something else...
END IF

(3) One specified condition zzz=uuu, and the other (implied) case of EVERYTHING ELSE which causes something else. Again, there can be any number of ELSE clauses. The ELSE IF and ELSE types may be used together in the same structure, i.e., "mix and match" as required. But the END IF has to be there to close out the structure.

IF zzz=uuu THEN
...do something...
ELSE
...do something else...
END IF

(4) The single condition zzz=uuu causes something to happen, otherwise the something doesn't happen.

IF zzz=uuu THEN
...do something...
END IF

(5) This is the ONLY case in which an END IF statement is not required:

IF xxx=yyy THEN do somethng.

The something here must be one single statement. If you need several lines of stuff to do, use the IF THEN...END IF type.

Also, if you fail to end a FOR/NEXT or DO/LOOP, or overlap any of these structures, you will also get the same error message. Best to always use indentations as a method of keeping track of what structure you're in so it will be clear when to close it out. Unfortunately one cannot indent on this forum the way it is set up, so displaying code here is very poor. Anyway I hope this helps.

Regards, Mike C.

Compiler error-no end if's

Thanks
corrected it and it ran.

Thanks again.