2
votes

I have the following Function:

Function getNext10(num)
    pageLen = len(num)
    If pageLen = 1 Then
        next10 = 10
    ElseIf pageLen>1 Then
        pageRem = 10
        pageTen = right(num, 1)
        next10 = num + pageRem - pageTen
    End If
    getNext10 = next10
End Function

If I use that function I get the following Error:

Microsoft VBScript compilation "800a03f4'

'If' expected

/display/paging.asp, row 27

End Function
------^

What is wrong with that function?

1
It works just fine. The problem is elsewhere. How you call the function? - Shadow Wizard Is Vaccinated V3
this is how i call the function: next10 = getNext10(CurrPage) - Paks
i did that already and i also declared the variables. I dont know where the problem coming from. Maybe i should post the whole code? - Paks
Yep try posting more code and we'll see. - Shadow Wizard Is Vaccinated V3
Thanks for helf Wizard, but i found the Error on my own... -.-. In my Original version i had Else If instead of Elseif, that fixed the error - Paks

1 Answers

0
votes

Try this:

Function getNext10(num)
    pageLen = len(num)
    If pageLen = 1 Then
        next10 = 10
    End If
    If pageLen>1 Then
        pageRem = 10
        pageTen = right(num, 1)
        next10 = num + pageRem - pageTen
    End If
    getNext10 = next10
End Function