Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
- Ada
- C
- Clojure
- C++
- C#
- D
- Dart
- Fortran
- Go
- Haskell
- JS
- JS
- JS
- Java
- Kotlin
- PHP
- Pascal
- Perl
- Python
- Python
- Ruby
- Rust
bool b = File.Exists(fp);
inquire (file=fp,exist=b)
let b = true;
try {
await access(fp);
} catch {
b = false;
}
Sets b to false if the access function fails due to fp not being visible to the process.
try {
Deno.statSync(fp)
} catch(_e) {console.error("File does not exist.")}
$b = file_exists($fp);
my $b = -f $fp;
_-f is the stat operator that checks for the existence of a file.