Asp classic 这个ASP代码有什么问题;你会怎么修理它

Asp classic 这个ASP代码有什么问题;你会怎么修理它,asp-classic,Asp Classic,当我运行脚本时,它会说 Microsoft VBScript运行时错误“800a01f5” 非法分配:“最大年龄” /classic.asp,第8行 以下是脚本: response.Write(GetMaxAge()) Function GetMaxAge() const MAX_AGE = 50 Dim iRtnValue MAX_AGE = 45 iRtnValue = MAX_AGE GetStudentAge = iRtnValue En

当我运行脚本时,它会说

Microsoft VBScript运行时错误“800a01f5”

非法分配:“最大年龄”

/classic.asp,第8行

以下是脚本:

response.Write(GetMaxAge())
Function GetMaxAge()

    const MAX_AGE = 50
    Dim iRtnValue

    MAX_AGE = 45

    iRtnValue = MAX_AGE

    GetStudentAge = iRtnValue

End Function

您返回的是GetStudentAge而不是GetMaxAge。我的意思是GetStudentAge=iRtnValue

最大年龄被定义为一个常数。不能更改常量的值

const MAX_AGE = 50

您已将MAX_AGE指定为常量。您以后更改它的具体原因是:MAX_AGE=45?您将常数视为变量。

如何声明最大年龄?