Local variable inside a function (VB.net)
<script language="vb" runat="server">
Sub Page_Load()
Response.Write ("<BR />Calling Subroutine 1...")
Call Subroutine_1()
Response.Write ("<BR />Calling Subroutine 2...")
Call Subroutine_2()
Response.Write ("<BR />Calling Subroutine 1...")
Call Subroutine_1()
End Sub
Sub Subroutine_1()
Dim Different As String
Different = "<i>Hello I'm the variable Different in Subroutine 1</i>"
Response.Write (Different)
End Sub
Sub Subroutine_2()
Dim Different As String
Different = "<b>Hello I'm the variable Different in Subroutine 2</b>"
Response.Write (Different)
End Sub
</script>
<html>
<head>
<title>Scope</title>
</head>
<body>
</body>
</html>
Related examples in the same category