This is really what got my thought-process flowing on this subject.  I saw
this code on github after the Rocket Software "Whats New in 11.2" webinar:

https://github.com/RocketSoftware/u2-servers-lab/blob/master/UniVerse-11.2/Local/BP/LocalMain

PROGRAM LocalMain
    ** Let's have a quick look at local scoping

    CRT "Calling the local SUBROUTINE"
    CALL Main(@SENTENCE) ;* This will call Main() below, rather than
an external subroutine
    CRT "Back from the local SUBROUTINE"

END

SUBROUTINE Main(Args)
    CRT "Running inside the local SUBROUTINE"
    CRT "Args:" :Args

    FOR Counter = 1 TO 3
        CALL InnerLoop(Counter)
    NEXT Counter
RETURN

SUBROUTINE InnerLoop(OutsideCounter)
    * Notice this won't affect Main()'s 'Counter' variable due to scoping
    FOR Counter = 1 TO OutsideCounter
        CRT "*":

    NEXT Counter
    CRT
RETURN
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to