This ASP scripting code allows you to display the content of an array. In addition, the script shows how to get the lowest and upper boundaries of an array. The script uses an array called arrWeekDays and three functions: GetLowestBoundary (), GetUpperBoundary (), and LoopThroughArray ().
The array arrWeekDays contains the seven days of the week. As you may be familiar with ASP arrays, the first index of the array is 0 and the last index is the total number of elements in the array minus 1. For example, an array consisting of 7 elements stores the first element at index 0 and the last element at index 6. We will verify this below.
The GetLowestBoundary () returns the lowest boundary of the array, which is 0. This indicates the first element of the array is stored at index 0.
The GetUpperBoundary () returns the upper boundary of the array, which is 6. This indicates the last element of the array is at index 6.
Finally, our LoopThroughArray () function, as the name implies, loops through the array to print each value in the array.
<%dim arrWeekDays, shtml ' declares two variablesarrWeekDays = Array("Sunday","Monday","Tuesday","Wednesday",_"Thursday","Friday","Saturday")shtml = "Lowest boundary of our array: " & GetLowestBoundary (arrWeekDays)shtml=shtml & "<br>Upper boundary of our array: " & GetUpperBoundary(arrWeekDays)shtml=shtml & "<br>Content of our array: " & LoopThroughArray (arrWeekDays)response.write shtmlfunction GetLowestBoundary (arrName)GetLowestBoundary = LBound(arrName)end functionfunction GetUpperBoundary (arrName)GetUpperBoundary = UBound(arrName)end functionfunction LoopThroughArray (arrName)dim sout, arrValuesout = "<ul>" ' start unordered listfor each arrValue in arrName ' loop through the arraysout = sout & ">li<" & arrValue & "</li>" ' store each value in arraynextsout = sout & "</ul>" ' end listLoopThroughArray = sout ' return the outputend function%>