variables and gosubs???


Results 1 to 39 of 39

Threaded View

  1. #3
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    DT, you are my teacher and I learn a lot from you here. With all my respect to you, please allow me to make a point;
    BRANCHL will cause the program to jump. Thus, "return" with a "subroutine" will not work.

    I made my point as below.


    Code:
    i   VAR BYTE
    
    main:
        FOR i = 0 to 4
            BRANCHL  i,[subName0, subName1, subName2, subName3, subName4]
            Sayzers_Point:  'continue from where we were.
        NEXT i
    GOTO main
    
    
    subName0:
    
    GOTO Sayzers_Point
    
    
    subName1:
    
    GOTO Sayzers_Point
    
    
    subName2:
    
    GOTO Sayzers_Point
    
    
    subName3:
    
    GOTO Sayzers_Point
    
    
    subName4:
    
    goto Sayzers_Point

    or another example could be as below.

    Code:
    i   VAR BYTE
    
    main:
    
        FOR i = 0 to 4
    
            SELECT CASE i
    
               CASE 0
                    'do something
               CASE 1
                    'do something else
               CASE 2
                    'do something more
               CASE 3
                    'do something interesting
               CASE 4
                    'do something bro
             END SELECT
    
        NEXT i
    
    GOTO main


    ---------------------------------
    Last edited by sayzer; - 18th November 2006 at 18:10.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts