'exit function'...always use it when returning a value?

  • Thread starter Thread starter darrel
  • Start date Start date
D

darrel

This might be a really dumb question, but when should/shouldn't one use the
exit function command?

If I have this:

function()
if something then
do this
return that
else
do this
return that
end if
end function

should I instead always use this instead:

function()
if something then
do this
return that
exit function
else
do this
return that
exit function
end if
end function

or does the very act of returning something exit the function?
 
"or does the very act of returning something exit the function?" <-- yes

You really only would need to use exit function if you were familiar with the old VB6 way of functions, where you had to set the function name = return value. But using the return statement immediately exits the function (and why shouldn't it?)
 
Back
Top