end if without block if error

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Quicky
Coder
Posts: 20
Joined: Wed Jun 13, 2007 10:51 am

end if without block if error

Post by Quicky »

What does then END IF without block IF error mean?
sid6.7
Veteran
Posts: 318
Joined: Tue Jun 21, 2005 8:51 am
Location: west USA
Contact:

Post by sid6.7 »

in your nesting of IF THEN statements

you have and END IF that doesnt have a preivous IF...


IF blah blah


THEN blah blah


END IF

you may have a whole bunch of these nested one within another
go back and match them up...
Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

Post by Patz QuickBASIC Creations »

I'll try to explain...

A block IF/THEN is an IF/THEN with the following syntax:

Code: Select all

IF <condition> THEN
<command>
<another>
<hey, look! it's another command!>
END IF
The main plus about it is that you can have multiple commands execute, as opposed to the line IF/THEN, or:

Code: Select all

IF <condition> THEN <command>
The error you described is means that the END IF is missing in that block, but is not needed for the line IF/THEN.
Erik
Veteran
Posts: 72
Joined: Wed Jun 20, 2007 12:31 pm
Location: LI, NY
Contact:

Post by Erik »

Check to see if you don't have an extra "END IF" in your IF statement blocks.

I know I've found myself doing that sometimes when they get large... (esp. when they're nested)
Post Reply