I'm a grade 11 student and I am coding in Basic language. I asked the user a question, and the user gets to choose yes or no. In the coding, a "type mismatch" error displayed. Also in the coding, after the question, I coded in some IFs and END IFs, and before I had this problem, it printed 0 when I ran the program.
I'm confused as to why I'm getting a type mismatch, even though my variables in the area of the IFs and END IFs. I have a string with $ at the end as the variable. This is what I have.
A part of the program is supposed to calculate the total insurance of someone renting a car, but the computer needs to know if the user even wants insurance. Even if I say I do want insurance, the program still displays 0 when it outputs the insurance at the end of the program.
So my question is, why am I getting a type mismatch?
Print "Do you want insurance?"
Print "1.Yes"
Print "2.No"
Input strInsurance$
IF strInsurance$=Yes THEN
strInsurance$=sngDailyInsurance*sngDays
END IF
IF strInsurance$=No THEN
strInsurance$=0
END IF