Check that file exists: Difference between revisions

Added Odin variant
m (Automated syntax highlighting fixup (second round - minor fixes))
(Added Odin variant)
Line 2,097:
}
</syntaxhighlight>
 
=={{header|Objective-C}}==
<syntaxhighlight lang="objc">NSFileManager *fm = [NSFileManager defaultManager];
NSLog(@"input.txt %s", [fm fileExistsAtPath:@"input.txt"] ? @"exists" : @"doesn't exist");
NSLog(@"docs %s", [fm fileExistsAtPath:@"docs"] ? @"exists" : @"doesn't exist");</syntaxhighlight>
 
=={{header|Odin}}==
 
<syntaxhighlight lang="odin">package main
 
import "core:os"
 
main :: proc() {
os.exists("input.txt")
os.exists("/input.txt")
os.exists("docs")
os.exists("/docs")
}</syntaxhighlight>
 
=={{header|OCaml}}==
<syntaxhighlight lang="ocaml">Sys.file_exists "input.txt";;
29

edits