You can edit almost every page by Creating an account and confirming your email.

Existence detection

From EverybodyWiki Bios & Wiki


Existence checking or existence detection is an important aspect of many computer programs. An existence check before reading a file can catch and/or prevent a fatal error, for instance. For that reason, most programming language libraries contain a means of checking whether a file exists.

An existence check can sometimes involve a "brute force" approach of checking all records for a given identifier, as in this Microsoft Excel Visual Basic for Applications code for detecting whether a worksheet exists:

Function SheetExists(sheetName As String) As Boolean
    Dim sheetCount As Integer
    Dim t As Integer

    SheetExists = False
    sheetCount = ActiveWorkbook.Sheets.Count
    For t = 1 To sheetCount
        If Sheets(t).Name = sheetName Then
            SheetExists = True
            Exit Function
        End If
    Next t
End Function

See also

References



This article "Existence detection" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Existence detection. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.