首页 > 解决方案 > 经典 ASP:无法从函数返回 False,我收到类型不匹配错误

问题描述

' Determines if a file contains any of an array of lines.
' Case insensitive comparison.
Function DoesFileContainAnyLine(filename, lines)
    Dim fs
    set fs=Server.CreateObject("Scripting.FileSystemObject")
    If fs.FileExists(filename) Then
        set f = fs.OpenTextFile(filename, 1, true) 
        Do Until f.AtEndOfStream 
            Dim line
            line = f.ReadLine
            For Each needle in lines
                if LCase(Trim(needle)) = LCase(Trim(line)) Then
                    return true
                end if
            Next
        Loop
    End If
    Return False
End Function

我在线上收到类型不匹配错误Return False;为什么我不能从函数中返回 false?

标签: vbscriptasp-classic

解决方案


推荐阅读