BB___GOTO

=GOTO= toc =Program Flow Control Command=

Description
> GOTO 'label' sends the program to the first statement after the 'label'. The 'label' can be a [branchLabel] or a line number. Program flow is transfered to the first statement after the 'label' and continues on.

> See Branch Label.

Syntax

 * 1) goto //{[branchLabel]} or {line number}//

Hints
> GOTO does //**NOT**// return to the line following the GOTO statement as does the GOSUB statement.

> Do NOT attempt to leave loop via GOTO bypassing loop terminating operator - there are examples, then exiting loops (FOR, DO, WHILE) with GOTO corrupts JB stack, leading to unexpected behavior.

Example
code format="vbnet" [numbers] print "1 2 3 4"

goto [letters] ' GOTO sends program to branch label and does not return here. print "This text will not print."

[letters] print "a b c d"   print "This text will print!" print "And then the program will end."

end

code

Useful Functions
code format="vbnet" Place a useful function using this command here code

=Graphics Method=

Description
> In a graphics window or graphicbox, GOTO moves the pen from the current position to position x y. A line is drawn if the pen is down. If the pen is up, no line is drawn, but the pen is moved to x y.

> A similar command, place also moves the pen but does //not// draw a line even if the pen is down.

Syntax
//This command is NOT case sensitive//. Using literal values: Using variable values: > x y are horiz and vert coords from upper left corner of window.
 * 1)  - in graphics window
 * 2)  - in graphicbox

Hints
Here is a list of commands that affect the pen position or status: down go goto home north place posxy set size turn up

Example
An example of the command in a graphics window. code format="lb" nomainwin WindowWidth=400 WindowHeight=300

open "Command Demo" for graphics_nsb_nf as #g #g "trapclose [quit]"

'put pen down #g "down" x=100 : y=100 'move the pen to x y and draw a line #g "goto "; x; " "; y   #g "goto 0 270" #g "place 390 0" #g "goto "; x; " "; y   #g "goto 390 270" #g "place "; x; " "; y   #g "backcolor red" #g "circlefilled 10" wait

[quit] close #g end code

An example of the command in a graphicbox. code format="lb" nomainwin WindowWidth=400 WindowHeight=300

graphicbox #g.gb 2, 2, 390, 270 open "Command Demo" for graphics_nsb_nf as #g #g "trapclose [quit]"

'put pen down #g.gb "down" 'move the pen to 100 100 and draw a line #g.gb "goto 100 100" wait

[quit] close #g end code

Useful Functions
code format="lb" Place a useful function using this command here code