We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to exit a subroutine half way through
#2
(translated by Google translator)

Hello, Yumda.  Shy

At the very end of the subroutine, I insert some necessary line of code or an empty operation, like this: "x = x".
Before this line I insert a transition label, for example: "subName_Exit:".

Now I can jump to the end of the subroutine from anywhere in the code to exit it.

' ---
Sub Test
  ...  ' any code

  Goto subTest_Exit

   ... ' any code
  subTest_Exit:
  x = x
EndSub
' ----
[-] The following 1 user Likes AbsoluteBeginner's post:
  • litdev
Reply


Messages In This Thread
RE: How to exit a subroutine half way through - by AbsoluteBeginner - 11-11-2024, 06:36 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)