ASP.NET Functions

Sub program that can take data called parameters (optional), execute a computation (task) and return a value.
Function is a reusable piece of code. By reusable we mean that you need to make only once but you can use it many times. for example, a function of addition on a calculator. the keywords for making a function are function, return, end function. as functions, sub routines and classes are the part of VB.net, thats why we will use a separat block for it, instead of using asp block. the tag for this block is "< SCRIPT > " Example is below

<script runat="server">
            function add(a as integer, b as integer)as integer
                        Dim c as integer
                        c = a + b
                        return c
            End function
</script>

<%
            response.Write(add(3, 8))
            response.Write("<BR>")
           
            response.Write(add(73, 83))
            response.Write("<BR>")
           
            response.Write(add(45, 456))
            response.Write("<BR>")
%>

<script runat="server">
           
            function vat(price as decimal) as decimal
                        Dim result as decimal
                        result = price * 17.5/100
                        return result
            end function
           
</script>

<%
            response.Write(vat(100))
            response.Write("<BR>")
           
            response.Write(vat(500))
            response.Write("<BR>")
           
            response.Write(vat(1000))
            response.Write("<BR>")
           
%>