Exists

Updated: 12/31/2022 by Computer Hope

A function used to determine if something is valid or found. For example, in Perl the exists function could be used with an array or a hash to determine if a value exists. In the example below, if the example value exists in the test array the computer would print "Test exists..." to the computer screen.

print "Test exists..." if exists $test{example};

Some programming languages or script languages also use exist, which performs the same or similar function, but under a different name. For example, the MS-DOS if command can use an exist function. See the MS-DOS if command page for further information and examples of how to use the MS-DOS if command.

Exist, If statement, Programming terms