LoginLogin

Noob/help with IF

Root / Programming Questions / [.]

KrondeloCreated:
Hey guys, new here. Sorry for posting what seems to be an easy question but at least someone should be able to answer easily. I'm starting to practice with simple text adventure, making use of input variables, choices, and if statements. I'm new to BASIC and I have tried solving this problem on my own. I looked at examples and still don't see why it's not working. Here is the section of code: Input "Before heading downstairs do you grab a weapon (Y/N)"; V1$ Wait 30 IF V1$==Y THEN PRINT "You grab a screwdriver from the desk" ELSEIF V1$==N THEN PRINT "You don't grab a weapon" ENDIF ============================= I also tried the same with just ELSE. I don't get a syntax error, but the code only works for Y. If I enter N I get both responses.

Y and N need quotes around them. Without quotes, they are the variables named Y and N (which will be equal to 0) rather than the strings "Y" and "N"

Ah... duh, lol. Yeah I still have a long way to go, but sometimes I just need someone to point out those little mistakes, thanks I'll go fix it now.