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 its 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 youd like to exit only a Loop then you can use "break" (at least in C# - dont 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 dont know either if the break statement will work there, the return statement will work as an "Exit Sub" or "Exit Function"
 
Back
Top