Ad Space — Top Banner

?UF ERROR

Tandy / Radio Shack TRS-80

Severity: Minor

What Does This Error Mean?

?UF ERROR means you called a user-defined function (FN) that has not been defined with DEF FN. Make sure the DEF FN statement has been executed before the function is called. Check the function name for typos.

Affected Models

  • TRS-80 Model I
  • TRS-80 Model II
  • TRS-80 Model III
  • TRS-80 Model 4
  • TRS-80 Color Computer (CoCo)
  • MAME TRS-80 emulator
  • trs80gp emulator

Common Causes

  • Calling FN before the DEF FN statement has been executed
  • Function name misspelled — FNA called but DEF FNB defined
  • DEF FN statement on a line that was skipped by GOTO or IF
  • Accidentally deleted the DEF FN line

How to Fix It

  1. Make sure the DEF FN line is executed before the FN call.

    DEF FN must run before you can use the function. Place DEF FN statements near the top of your program so they execute first.

  2. Check that the function name matches exactly.

    DEF FNA(X) = X*2 defines FNA, not FNB. If you call FNB, you get ?UF ERROR because FNB does not exist.

  3. Make sure no GOTO or IF skips over the DEF FN statement.

    If your program jumps over the line containing DEF FN, the function is never defined. Move DEF FN to a line that always executes.

Frequently Asked Questions

How do I define a function in TRS-80 BASIC?

Use DEF FN followed by a single letter: DEF FNA(X) = X * 2 + 1 Then call it anywhere with FNA(5), which would return 11.

How many user functions can I define?

You can define up to 26 functions: FNA through FNZ. Each takes one argument and returns one value.