An editor has nominated this article for deletion. You are welcome to participate in the deletion discussion , which will decide whether or not to retain it. |
This article has multiple issues. Please help improve it or discuss these issues on the talk page . (Learn how and when to remove these messages)
|
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:
FunctionSheetExists(sheetNameAsString)AsBooleanDimsheetCountAsIntegerDimtAsIntegerSheetExists=FalsesheetCount=ActiveWorkbook.Sheets.CountFort=1TosheetCountIfSheets(t).Name=sheetNameThenSheetExists=TrueExitFunctionEndIfNexttEndFunction