Goto Statement

Top  Previous  Next

 

Function:

Jumps to a specific point in code, marked by a label.

Syntax:

 

goto label

...

label:

Scope:

Local and HTML

See Also:

---

 


Part

Description

label

Required. Marks a specific point in code.

Details

Unconditionally jumps to label in code. Notice that all goto labels are local -- you cannot use goto statement to jump from within one procedure into another procedure!

Examples

 

dim arr1(5),arr2(5),f as byte

 

sub on_sys_init

 

arr1(0) = 1

arr1(1) = 2

arr1(2) = 3

arr1(3) = 4

arr1(4) = 5

 

arr2(0) = 1

arr2(1) = 2

arr2(2) = 2

arr2(3) = 4

arr2(4) = 5

 

'compare arrays and jump if not exactly the same

for f=0 to 4

       if arr1(f)<>arr2(f) then goto not_the_same

next f

'here when both arrays contain the same data

exit sub

 

'here when arrays are not the same

not_the_same:

'... place code here ...