Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function and sub...

Status
Not open for further replies.

SQLReaver

Programmer
May 20, 2000
7
0
0
US
Hi,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I've been programming in asp fairly often now and I pretty much get how to run everything.&nbsp;&nbsp;However, I still don't know what's the difference between function and sub except for the fact that subs can't be used where functions are required.&nbsp;&nbsp;I have no problem with coding using subroutines and functions but I sure like to know what's the difference between them.
 
Basically a function is passed a value and then returns something (like a black box)<br>Like so:<br><br>Public Function Circumference(Radius)<br>&nbsp;&nbsp;&nbsp;&nbsp;Circumference = Radius * 2 * 3.124159<br>End Function<br><br>So a value is passed back to the name<br>to call the above would be<br>X = Circumference(3)<br>and X would have the result in it<br><br>Where as a Subroutine is called to perform something and then returns when done.<br>It does not return a value back to a variable <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top