1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
# subroutine_global - test local and global variables
# 2012-10-06 j.m.reneau
# we should see the global variables change in the "changeroo" but not the others
global a,b$
a = 0
b$ = "a's original value is zero"
c = 1
d$ = "c's original value is one"
call display(a,b$)
call display(c,d$)
call changeroo()
call display(a,b$)
call display(c,d$)
end
subroutine display(c,d$)
# c and d$ are not global - so local to the subroutine
print c + " " + d$
end subroutine
subroutine changeroo()
# change a,b$,c,d$
# only the global variables should be changed
a = 2
b$ = "a's new value is two"
c = 3
d$ = "c's new value is three"
end subroutine
|