nub question

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

Guest

I'm new to programming and alot of the tutorials and books i'm looking at
have things like
Public Sub, Private Sub, Public Function, etc what is the difference on the
3 and when should each one be used?
 
You missed a 4th one: Private Function.

Function vs. Sub: A function returns a value from it. A sub does not
return a value. So the choice is of which to use obvious based on if you
need a value returned

Public vs. Private: This is a scope identifier. Public function/subs can be
called from outside the class. Private function/subs can be called only
inside the class. Use private unless you have a reason to make the function
aviable from outside the class. Any function you call such as
String.SubString(...) is marked as public.

Chris
 
Subs or subroutines are different from functions only in that a function
will return something, where a sub is not intended to return anything to the
caller.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top