Preston
Preston

Reputation: 167

VBScript Function Name Maximum Length

I'm wondering what the maximum allowed length of a function name in Classic ASP (VBScript) is.

Upvotes: 4

Views: 2164

Answers (2)

Sebastian Castaldi
Sebastian Castaldi

Reputation: 9014

I think it is 255, but you should not abuse it :)

From the MSDN reference for Function:

name
Name of the Function; follows standard variable naming conventions.

And from the MSDN reference for Variables:

[...] A variable name:

  • Must begin with an alphabetic character.
  • Cannot contain an embedded period.
  • Must not exceed 255 characters.
  • Must be unique in the scope in which it is declared.

Upvotes: 3

Alex K.
Alex K.

Reputation: 175896

The following fails with identifier too long @ 256 characters

for i = 1 to 1024
    execute "function " & string (i, "X") & ": end function"
    WScript.echo i
next

Upvotes: 5

Related Questions