News Contact
Web Development Design UK USA India, Web Software Applications Development Programming Contact Custom Web Software Developers Programming Company India Contact Web Software Development Company Call Request For Web Software Development Programming RFI RFP RFQ Web Development Design UK USA India, Web Software Applications Development Programming Contact website development and web design company, advanced portal development UK USA Site Map: Internet applications to discover your NET potential

hat are functions and subroutines in ASP?

Functions and Subroutines are simple applications of ASP which are applied to make programming effortless and time saving. Both of them are re-usable codes which are easy to manage and have to be written once. The codes can be called upon when required. These two basic applications of ASP have been discussed in this article.


They provide alternatives to developers in constructing a code that can be used again and again for all the projects.

Functions provide developers with an option to produce code that can be used time and time again within a project and beyond, yet many ASP developers tend to shy away from using them extensively.

Functions return to you a value based on the information you provide.

Function Example:

Function getAnimal(strCard)

Dim Tempstr

strCard = lcase(strCard) 'This converts the value lowercase.
Select Case strCard

Case "tiger" Tempstr = "Here is your tiger card"

Case "horse" Tempstr = "Here is your horse card"

Case "dog" Tempstr = "Here is your dog card"

Case "fish" Tempstr = "Here is your fish card"

Case Else Tempstr = "Sorry, we have sold out of that Animal"
End Select

getCard = Tempstr
End Function

The information passed as a Function, is known as an 'argument'. The information we get back from a Function is known as the 'return value'. A Function can have many arguments, but only one return value.


Subroutines can save you having to repeat blocks of code. The use of subroutines may be very useful when there are a lot of instructions to be performed within a subroutine. This way it will allow us to simplify the structure of our script. Subroutines do not send back the information instead uses the data

Example 1


if TheName="John" then
response.write ("Hi, John. How are you?")
response.write ("<br>Did you know I got married last month?")
response.write ("Hi. How are you?")
end if

Example 2


if TheName="John" then
end if

Sub ResponseToJohn()
response.write ("Hi, John. How are you?")
response.write ("<br>Did you know I got married last month?")
End Sub

Sub ResponseToUnknown()
response.write ("Hi. How are you?")
End Sub


In order to call a subroutine, we will use this kind of code:


Where Whatever is the name of the subroutine (it is recommended to use a very descriptive name of the task we want to perform within the subroutine to make it easier to understand the script). We may also provide information to the subroutine in order to perform the specified task. The data will be provided this way:

Whatever(data1, data2 ... dataN)

This article gives a brief description of Functions and Subroutines which will help you in writing effective codes.

This article has been compiled by the content development team at Pegasus InfoCorp which pulls subject matter specialists from different work domains. They can be contacted through the Pegasus InfoCorp website at Pegasus InfoCorp is an India based web design, web development and online/ offline software development company. Please visit to read more articles and know more about us!

Other companies and organizations are welcome to reprint this article on their websites provided the following conditions are met.

  • The article is not changed in any manner
  • The article is copied as is in its entirety (including back links to the Pegasus InfoCorp website).
  • The company/ organization reprinting the article agrees to defend, indemnify and hold harmless Pegasus InfoCorp, its employees, directors, officers, agents, partners and their successors and assigns from and against any and all liabilities, damages, losses, costs and expenses, including attorney's fees, caused by or arising out of claims based upon the use of the article, including any claim of libel, defamation, violation of rights of privacy or publicity, loss of service by subscribers and infringement of intellectual property or other rights.
,designing distributed ie5 ldap msmq xml,application architecture asp enterprise mts vb ,application asp building,distributed dna msmq professional soap vb web window ,2.0 application asp building cold developer enabled fusion guide jsp
professional voice voice xml,application asp new zealand ,asp php web application builder professional ,asp net application application asp jsp programming services web web xml ,application asp court true tulsa ,application asp draw  Articles
object,application on server asp , application mls asp ,application asp hosting Blogs
asp contract developer jobserve london, asp developer  ,asp developer jobserve london permanent  ,.net asp basic India Info
developer guide net r visual xml, .net asp design developer development ecommerce hire india india india india india
outsource outsource php php php programmer programming programming web web web ,.net asp developer guide ,asp basic basic ,developer developer guide guide iis visual visual  ,asp basic commerce developer e guide server sql visual  ,asp cd developer  Home
guide included rom ,.net asp basic c developer including kit visual ,subroutine ,perl subroutine Featured Clients
asp hosting asp , asp web hosting , asp net hosting , asp .net , asp host , asp shopping cart , asp baton , 170320 asp free id online render survey survey , asp tutorial , asp world tour , free asp , asp net , asp domain , asp surfing , asp email , Why Choose Pegasus ?
asp c , .net 2.0 2005 asp beginning c# commerce e from in novice professional , asp contract developer jobserve london , aspServices
and dotnet in wilmington , asp programming , asp content management , asp net web hosting , cheap asp hosting , asp tactical  Solutions
baton , asp , free asp hosting , asp e commerce , asp , erp asp , asp designer , asp script , 8 asp cold dream from from fusion macromedia php source Contact Us
source training training weaver , asp domain name , asp ecommerce , asp web host , asp id , free asp web hosting , asp web site hosting ,Site Map
asp sql server web hosting , asp tour , asp code , asp developer ,asp pages , url asp , asp help desk software , asp component ,
free asp script , asp handcuffs , 2nd asp edition in nutshell , asp surf , asp news , asp cheap hosting site web , asp domain java name php script security statistics traffic , asp file , Rupali
learn asp , web hosting asp cheap , asp net tutorial , free asp tutorial , 2003 access asp by example programming vba xml ,  Port of Mundra
asp expandable baton , macromedia dream weaver mx 2004 with asp cold fusion and php training from the source , asp shopping  Aus RFID
cart source code , asp shopping cart software , crystal report asp , asp database , asp consultant , asp lady sd , asp  Planet Bombay
training , .net asp programmer , asp chart , asp forum , asp chicago programming , asp chicago consultant , asp hosting  Marlex
shared , asp calendar , asp consultant naperville , asp web hosting services , asp snake , asp hosting sql , asp database ICUIL
deleting entry , asp insect , asp snpha , crm asp , asp web mail , web hosting asp mysql , asp form , asp application , free  Steinmetz
asp code , asp wct , mdoc asp otis2.html , microsoft asp , asp baton home page , asp upload , asp caterpillar , affordable asp web hosting , asp pulley , asp learning by example , asp software , instant asp script Smart Fashions
Read More
© 2006, Pegasus InfoCorp Pvt. Ltd. All Rights Reserved. Install Shockwave Flash™