Ad Space — Top Banner

TM Error

Tandy Retro Computer

Severity: Minor

What Does This Error Mean?

TM is 'Type Mismatch'.
You assigned a string to a numeric variable, or used a number where a string was needed.
Numeric variables don't end in $; string variables do.
A = "HELLO" fails — A$ = "HELLO" works.

Affected Models

  • TRS-80 Model I
  • TRS-80 Model III
  • TRS-80 Model 4
  • TRS-80 Color Computer (CoCo)

Common Causes

  • Assigning string literal to numeric variable: A = "X"
  • Using a numeric variable in a string function: LEN(A) instead of LEN(A$)
  • Forgot the $ — A = INKEY$ fails because INKEY$ returns a string
  • Concatenating with + on numbers and strings: A$ + 5

How to Fix It

  1. Locate the error line.

    TM ?? in .
    LIST that line.
    Look at every variable — does it end in $?

  2. Match types on both sides.

    Left of = and right of = must match: number = number, or string = string.
    If one side has " " or ends in $, both sides must.

  3. Use VAL and STR$ to convert.

    VAL(A$) converts a string of digits to a number: VAL("123") = 123.
    STR$(A) converts a number to a string: STR$(123) = " 123".
    Wrap your value when you need to bridge types.

  4. Check function arguments.

    LEN, MID$, LEFT$, RIGHT$, INSTR — all want strings.
    SQR, SIN, COS, RND — all want numbers.
    Mixing them up gives TM.

Frequently Asked Questions

Why does INPUT A$ accept anything but INPUT A only accepts numbers?

String inputs accept any characters until RETURN.
Numeric INPUT validates the result as a number, and if it can't, it asks again.
You don't get TM from INPUT itself — you get ?REDO from numeric INPUT, but TM happens later if your code mixes the wrong types.