Posts: 64
Threads: 11
Joined: Sep 2003
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
Posts: 394
Threads: 16
Joined: Jun 2003
put the AMD And other three letter abbreviations in quotes: "AMD"
ammit potato!
Posts: 64
Threads: 11
Joined: Sep 2003
din work..its still showing up..
plus, i want AMD etc as variables
Posts: 594
Threads: 11
Joined: Oct 2002
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
Posts: 394
Threads: 16
Joined: Jun 2003
damn, missed out on another slave... should have read the question more carefully.
ammit potato!
Posts: 64
Threads: 11
Joined: Sep 2003