error when checking - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: Qbasic "like" compilers/interpreters (http://qbasicnews.com/newforum/forum-5.html) +--- Forum: FB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-15.html) +--- Thread: error when checking (/thread-5928.html) |
error when checking - MNDRBNDR - 02-04-2005 my code is this if a$=b$ then exit do evidently this isnt all my code but the freebasic program simply doesnt check if a$=b$ it just skips the check and exits do , it assumes that a$=b$ any idea how to fix this problem? error when checking - Sterling Christensen - 02-04-2005 Can we see the rest of the code? here ya go - MNDRBNDR - 02-04-2005 Code: SETUP: this is it - MNDRBNDR - 02-04-2005 so what do you think ive added a couple lines in there just simply to error check and thats why i ended up here asking for help error when checking - Sterling Christensen - 02-04-2005 A$ seems to be serving two purposes here. Are you overwriting a useful value in A$ when you A$=INKEY$ ? Maybe you meant there to be two separate variables but accidentally used the same letter? For example, A$ = INKEY$ might set A$ to CHR$(255) + "H" (if the user presses the up arrow key), and then later MAKESEQUENCE might randomly change that to CHR$(255) + "H" + "T"... error when checking - steven_basic - 02-04-2005 You are testing for A$ and B$ to be empty ("") then exiting the DO Loop. If no key is pressed, then A$ and B$ both = "" and the do loop exits. Code: DO This will slow things down enough to get a keypress in... However, as soon as the loop cycles again with no immediate keypress, it bails out again. Maybe a logic restructure for what you want to accomplish is in order? error when checking - steven_basic - 02-04-2005 Looking closely at the code: You set A$ and B$ to be "" (empty). You call a routine to make A$ a set of "TLRB" string. You enter the loop and immediately set A$ to be INKEY$ which will clear A$ out ("") if no key is pressed. If A$ = B$, which at this point they both do, the the loop is exited. error when checking - ShadowWolf - 02-04-2005 Grrr GOSUB why did victor have to add that i know i know backwords compatiblity but it makes code so unclean. that was it - MNDRBNDR - 02-04-2005 that's what it was thank you i cant believe i overlooked something as simple as that muchly apreciated thank you |