C# equivalant to VB....

Rimmel said:
You can use "return" in VB.net as well......

Oh, so return exits a procedure/function?

VB has Exit.Sub, Exit.Loop, Exit.If

Does return do all of that? Just exit you out of your nearest clause?
 
Return will leave the function and return the value (if one is specified), regardless of whether it's inside a loop or not.
 
Denaes said:
Oh, so return exits a procedure/function?

VB has Exit.Sub, Exit.Loop, Exit.If

Does return do all of that? Just exit you out of your nearest clause?
If you'd like to exit only a Loop then you can use "break" (at least in C# - don't know whether it also works in VB.NET)... the program contiues to run in the same procedure/function but after the Loop you where just in..
 
hum I think in VB to exit a loop is "Exit For" I don't know either if the break statement will work there, the return statement will work as an "Exit Sub" or "Exit Function"
 
Back
Top