-
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
When I try to run this example from the docs:
x = 3: y = 4: GOSUB @add
PRINT result
END
@add
result = x + y
RETURN
It fails with an error:
ERROR: 2:7: Undefined variable result
I think this might be a result of static single-pass variable checking since when I run the program with the slight change below to print in the subroutine, it still fails without ever printing:
x = 3: y = 4: GOSUB @add
PRINT result
END
@add
result = x + y
PRINT result
RETURN
I'm not sure what the intended behavior is, but as it stands I think the example needs to declare the result variable before calling the subroutine.
DIM result AS INTEGER
x = 3: y = 4: GOSUB @add
PRINT result
END
@add
result = x + y
RETURN
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels