The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1677 - File: showthread.php PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/showthread.php 1677 errorHandler->error_callback
/showthread.php 916 buildtree




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Label as a string var
#1
Hi all

Long time no see around here :oops: but now I'm getting some free time to spend with ZX Basic, so I hope to come more often Smile
In fact, I have a question: I want to store a label name in a variable, in order to do GOSUBs using a var, not fixed names. I made this code so far, but it fails with the message 'identifier 'eti$' is a var, not a label':

Code:
#INCLUDE <keys.bas> paper 0: border 0: ink 7: cls dim eti$ eti$="l01" while 1=1 if Multikeys(KEY1)<>0 then eti$="l01" gosub eti$ elseif Multikeys(KEY2)<>0 then eti$="l02" gosub eti$ elseif Multikeys(KEY3)<>0 then eti$="l03" gosub eti$ end If end While l01: print at 0,0;ink 1;"ESTAS EN LA ETI1"; RETURN l02: print at 0,0;ink 2;"ESTAS EN LA ETI2"; RETURN l03: print at 0,0;ink 3;"ESTAS EN LA ETI3"; RETURN

Can be it done or what I'm asking is impossible right now? Note that I'm asking for a string, not numbers.

Thanks and regards
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)