Type Mismatch in Qbasic
Results 1 to 8 of 8

Thread: Type Mismatch in Qbasic

  1. #1
    Senior Member
    Join Date
    May 2003
    Posts
    407

    Post Type Mismatch in Qbasic

    I am writing a program in Qbasic, and whenever i try to run it i get a "Type mismatch" error.
    the line that it says the error is on is like

    if yesno$=Y then

    if you need more, just ask. Thanks in advance..
    \"Look, Doc, I spent last Tuesday watching fibers on my carpet. And the whole time I was watching my carpet, I was worrying that I, I might vomit. And the whole time, I was thinking, \"I\'m a grown man. I should know what goes on my head.\" And the more I thought about it... the more I realized that I should just blow my brains out and end it all. But then I thought, well, if I thought more about blowing my brains out... I start worrying about what that was going to do to my goddamn carpet. Okay, so, ah-he, that was a GOOD day, Doc. And, and I just want you to give me some pills and let me get on with my life. \" -Roy Waller

  2. #2
    would you mind attaching the whole source code file (*.txt if possible) and I will try my best to solve your problem
    http://www.danasoft.com/sig/c0bra.jpg
    click here to hack my computer and delete all my important files

  3. #3
    Senior Member tampabay420's Avatar
    Join Date
    Aug 2002
    Posts
    953
    ah, good ol' "Type Mismatch" Error Code 13 I believe

    Try making sure that you're not trying to pass a string to integer, or integer to string, etc... This error happens when you try to pass a value into a variable of the wrong type...

    Check your variable defenitions!
    yeah, I\'m gonna need that by friday...

  4. #4
    Member
    Join Date
    Oct 2003
    Posts
    85
    This has to do with conflicting datatypes (for example store a numeric input in a character variable).
    This is something simple that many programmers face.

    The FACT that people ignore FACTS
    doesnt mean that FACTS are not FACTS

  5. #5
    Member
    Join Date
    Feb 2002
    Posts
    84
    Try this:

    Code:
    INPUT "Do you want to go further?"; answer$
    
    IF answer$ = "Y" THEN ............
    
    IF answer$ = "N" THEN ............
    I hope this will help you a little further.
    [shadow]OpenGL rules the game[/shadow]http://www.AntiOnline.com/sig.php?imageid=499

  6. #6
    Senior Member
    Join Date
    Oct 2003
    Posts
    111
    I believe the problem is here, judging from the code you posted, that you forgot the "Y". You always have to do that when defining a string variable, or in your case a variable that is looking for a text input (a string). Just add the quotation marks at the beginning and end of the Y
    ex.
    if yesno$ = "Y" then

    Hope that helps!
    Creating further mindless stupidity....through mindless automation.

  7. #7
    Senior Member
    Join Date
    Oct 2003
    Posts
    107
    this is Qbasic... u must have " " aroud all non numerical charecters........ as this is a "Y" u must have it in " "

    if yesno$="Y" then <===this is the correct line I think

    10x u just reminded me of the day of Qbasic 10x

  8. #8
    Senior Member
    Join Date
    May 2003
    Posts
    407
    thanks for the help, it was really bugging me {rimshot}
    \"Look, Doc, I spent last Tuesday watching fibers on my carpet. And the whole time I was watching my carpet, I was worrying that I, I might vomit. And the whole time, I was thinking, \"I\'m a grown man. I should know what goes on my head.\" And the more I thought about it... the more I realized that I should just blow my brains out and end it all. But then I thought, well, if I thought more about blowing my brains out... I start worrying about what that was going to do to my goddamn carpet. Okay, so, ah-he, that was a GOOD day, Doc. And, and I just want you to give me some pills and let me get on with my life. \" -Roy Waller

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •