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
JasonQuinn1992
Coder
Posts: 42
Joined: Mon Sep 03, 2012 4:32 pm

End if Without Block If Error

Post by JasonQuinn1992 »

I can't figure out why Im getting an error on this code:

READ A
IF A > 10 THEN PRINT "THAT'S IT" ELSE PRINT "MAYBE NEXT TIME"
END IF
DATA 15,0
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

One line IF statements do not require END IF. It is only required when it is a statement block to indicate the end:

Code: Select all

IF A > 10 THEN
  PRINT "That's it"
ELSE PRINT "Maybe next time"
END IF
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
JasonQuinn1992
Coder
Posts: 42
Joined: Mon Sep 03, 2012 4:32 pm

Post by JasonQuinn1992 »

I was able to get this program to run thanks! :)
Post Reply