GOTO???
JINC_DEVCreated:
GOTO sends you to a specified label Example:^ it helps when you have sections of code were you switch them around but have@LOOP GOTO @LOOP
def/
endbetween the main loops for sections and you can say
acls while 1'main loop 'awesome code goes here if clear==1 then GOTO@sect2 wend def 'variable name 'user defined instructions end @sect2 while 1'main loop for second section 'awesome code goes here with different attributes for second section wend
GOTO works with these neat little things called ‘labels’ these labels essentially are words (letters and numbers without spaces) that start with the symbol ‘@‘ it should look something like this:
@Label ‘Doesn’t have to be the word label, it can be any word you want.Basically let’s say you have some code under that label:
@Label PRINT “HELLO WORLD”So you are at the part of your code where everything is confusing and you need to know your way around, and you want your program to read a certain part of your code. Then you use the GOTO command, like this:
@Label PRINT “HELLO WORLD” GOTO @LabelBasically what is happening above is you specify your label (Which is @Label) then you are printing the words “HELLO WORLD” to the console, and then you are telling the code to reread the line where it says @Label. This is honestly the simplest way I can put it, it’s probably easier if you get better examples rather than mine.. Just think of it this way, when a program runs, there it reads line by line, I’ll call this a “pointer.” And a label is like a checkpoint, it saves the position of a pointer, and when you are using a GOTO command, it moves your pointer all the way up to that checkpoint (represented as the label).
GOTO works with these neat little things called ‘labels’ these labels essentially are words (letters and numbers without spaces) that start with the symbol ‘@‘ it should look something like this:You can also use labels to skip over lines of code.@Label ‘Doesn’t have to be the word label, it can be any word you want.Basically let’s say you have some code under that label:@Label PRINT “HELLO WORLD”So you are at the part of your code where everything is confusing and you need to know your way around, and you want your program to read a certain part of your code. Then you use the GOTO command, like this:@Label PRINT “HELLO WORLD” GOTO @LabelBasically what is happening above is you specify your label (Which is @Label) then you are printing the words “HELLO WORLD” to the console, and then you are telling the code to reread the line where it says @Label. This is honestly the simplest way I can put it, it’s probably easier if you get better examples rather than mine.. Just think of it this way, when a program runs, there it reads line by line, I’ll call this a “pointer.” And a label is like a checkpoint, it saves the position of a pointer, and when you are using a GOTO command, it moves your pointer all the way up to that checkpoint (represented as the label).
GOTO @SKIP BGMPLAY 0 @SKIPAlso, if you want an infinite loop, use a WHILE WEND loop. They're so much better.
T$="Hello world!" WHILE 1 VSYNC GCLS FOR I%=0 TO LEN(T$)-1 GPUTCHR I%*16,104+FLOOR(32*SIN(2*PI()*((MAINCNT+I%)/90))) NEXT I% WEND