HOW TO INTERRUPT A SUBRUTINE?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Happy Holidays!

To exit a subrutine I use Exit Sub in VB. Is there something similar in C#?

Thanks!!!

Raul
 
Im not sure of other possible commands, but "Return" will probably work

Subroutine? Whats that?

If youre in a function thats declared as a void return, when it exits it
probably returns with zero then ignores the zero;
But you simply finish your subroutine with the last line of code and Exit
Sub is assumed? (Im assuming?)

Otherwise if you want to break out, it seems to me a "Return" should do it
 
If it doesn't return any values (i.e. it is a void method) then you can
simply use "return" to exit the method. If it does return a value though
then you'll have to specify something after the return keyword. In most
cases there is a default value that you can return - for example if it's a
boolean method you might want to return false by default. It really depends
on what the subroutine does.
~amit
 
Back
Top