Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Type Mismatch ?
#1
The following code shows a Type MismatchError!
Help!!!!!!!


INPUT "Choose The City Your Going From"; F$
IF F$ = 1 THEN LET F$ = AMD
IF F$ = 2 THEN LET F$ = BAN
IF F$ = 3 THEN LET F$ = CHE
IF F$ = 4 THEN LET F$ = COC
Reply
#2
put the AMD And other three letter abbreviations in quotes: "AMD"
ammit potato!
Reply
#3
din work..its still showing up..

plus, i want AMD etc as variables
Reply
#4
f$ is a string variable and 1 is an integer. You can't store an integer in a string variable.
If I understand you right, you want F$ to get the value of other strings (AMD; BAN; CHE; COC).

Do it like this:

Code:
INPUT "Choose The City Your Going From"; F$
IF F$ = "1" THEN LET F$ = AMD$
IF F$ = "2" THEN LET F$ = BAN$
IF F$ = "3" THEN LET F$ = CHE$
IF F$ = "4" THEN LET F$ = COC$

But there is a better way. If you compare one variable several times you can use this:

Code:
INPUT "Choose The City Your Going From"; F$
SELECT CASE F$
CASE "1": F$ = AMD$
CASE "2": F$ = BAN$
CASE "3": F$ = CHE$
CASE "4": F$ = COC$
END SELECT

As you see I don't use the command LET, because it is useless and only used for compatibility to older compilers of BASIC
B 4 EVER
Reply
#5
damn, missed out on another slave... should have read the question more carefully.
ammit potato!
Reply
#6
got it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)