I have an IF statement in QBASIC… yes… QBASIC…
I have been teaching someone to program (I decided this would be nice and easy to see
how the syntax works).
…Anyway, I have this code:
CLS
start:
INPUT ">>", a$
PRINT a$
IF (INSTR(a$, "do you")) THEN
IF (INSTR(a$, "like")) THEN
IF (INSTR(a$, "cheese")) THEN PRINT "Yep, I like cheese":
IF (INSTR(a$, "music")) THEN PRINT "Depends, which genre?": GOTO musicGenre
ELSE IF (INSTR(a$, "hate")) THEN
IF (INSTR(a$, "cheese")) THEN PRINT "No, I like cheese"
END IF
END IF
END IF
musicGenre:
INPUT ">>", m$
SELECT CASE (m$)
CASE "pop"
PRINT "..pop! lol, baa baa"
CASE "rock"
PRINT "Rock is ok"
END SELECT
GOTO start
But when I type “do you like cheese?” it seems to only reply “Yep, I like cheese” every other time…
Could anyone shed some light on this?
note:
“do you like music?” works every time…
note 2:
Screenshot of the output:

Your code you provided appears correct.
Try one of the following:
a$) before the firstIFto confirm your code will be working with the expected input.FALSEis zero and true is anything else. However, you may want to be more explicit with the followingIF (INSTR(a$) > 0).EDIT: You should put a
goto starton any cheese result. Otherwise, it’s going to themusicGenrecode.