BrianT
- 20th June 2009, 00:00
I am not sure if this is a programming style question a potential stack overflow issue.
Is it OK to have multiple RETURN statements within a single subroutine? Is there a depth limit? I have tested the multiple return subroutine up to 10 deep with no apparent problems.
/code
SubCheck: 'this is the dummy subroutine
if a = 0 then
b = 1000
return
if a = 1 then
c = 12*a
return
if j = 6 then
d = 255
return
return
'This is the calling code
code, code, code
gosub subcheck
morecode, morecode
/endcode
Cheers
Brian
Is it OK to have multiple RETURN statements within a single subroutine? Is there a depth limit? I have tested the multiple return subroutine up to 10 deep with no apparent problems.
/code
SubCheck: 'this is the dummy subroutine
if a = 0 then
b = 1000
return
if a = 1 then
c = 12*a
return
if j = 6 then
d = 255
return
return
'This is the calling code
code, code, code
gosub subcheck
morecode, morecode
/endcode
Cheers
Brian