home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / src / ASP / function.asp < prev    next >
Encoding:
Text File  |  2001-06-08  |  1.1 KB  |  35 lines

  1. <%
  2. '*******************************************************
  3. '*     ASP 101 Sample Code - http://www.asp101.com     *
  4. '*                                                     *
  5. '*   This code is made available as a service to our   *
  6. '*      visitors and is provided strictly for the      *
  7. '*               purpose of illustration.              *
  8. '*                                                     *
  9. '* Please direct all inquiries to webmaster@asp101.com *
  10. '*******************************************************
  11. %>
  12.  
  13. <%
  14. ' This function takes two integers and ads them together.
  15. Function Add(intA, intB)
  16.     ' Declare a variable to store the result.
  17.     ' Since it was declared inside the function
  18.     ' you can only access this variable while
  19.     ' you're inside the function.
  20.     Dim intResult
  21.     
  22.     ' Do our calculation and store the result.
  23.     intResult = intA + intB
  24.     
  25.     ' Set our return value by assigning it
  26.     ' to the function's name.
  27.     Add = intResult
  28. End Function
  29. %>
  30. <p>Here are a couple examples of calling the function:</p>
  31.  
  32. <p>1 + 2 = <%= Add(1, 2) %></p>
  33.  
  34. <p>534 + 3142 = <%= Add(534, 3142) %></p>
  35.