LoginLogin

Uninitialized variable (error 48)

Root / FAQs / [.]

12Me21Created:
There is a "hidden" error (not listed in the help menu) Uninitialized variable This means that a return value wasn't specified in a function:
DEF EXAMPLE(EX)
 IF EX==1 THEN RETURN 1
END
Looks OK, but if EX isn't 1, the function will reach END and have nothing to return. IT should be changed to
DEF EXAMPLE(EX)
 IF EX==1 THEN RETURN 1 ELSE RETURN 0
END
And also:
DEF EXAMPLE EX OUT EX2
 IF EX==1 THEN EX2 = 1
END
should be
DEF EXAMPLE EX OUT EX2
 IF EX==1 THEN EX2 = 1 ELSE EX2 = 0
END
This error can also happen when you make a typo like:
VARIABLE=

Oof I should've just searched for this error. I got stuck on this just today. Thanks.

I had to search for this, as this error is not described in the error table of the build-in manual. Thanks a lot!