|
Variables hold string or numeric data. Functions and subroutines are block of codes that you can call to execute by their name. In general the difference between a function and sub is that the function can return a value. Both function and subroutine can take input values, as shown in the makedouble() function in the example below. Variables , functions and displaying data. In this example we will use the basic HTML page, from the previous example and test. You can run asp code from anywhere within an html page, provided that the page is saved as a .asp page on the server. Asp code blocks are written within <%%> tags. So wathever is written between <%%> tag is executed on the server and it will show some output if you say so. There are two ways to display something to the browser from asp. Either use response.write "mydata" or use the <%="mydata"%> tag. In both cases I am outputting a string value. First we will declare a variable named i. Then we will assign a value 2 to the variable. I have written two functions and a
subroutine. The subroutine named Then I am calling Now(), which is a built in function that returns the current system time and date. Asp comes with many subroutines and function, check the manual to find them all. Comments In asp comments are written after
'. Look at line number two:
|
||