Check that file exists: Difference between revisions

m
→‎{{header|Ruby}}: File.exists is deprecated
(Omitted EasyLang)
m (→‎{{header|Ruby}}: File.exists is deprecated)
Line 2,632:
</syntaxhighlight>
=={{header|Ruby}}==
<code>File.existsexist?</code> only checks if a file exists; it can be a regular file, a directory, or something else. <code>File.file?</code> or <code>File.directory?</code> checks for a regular file or a directory. Ruby also allows <code>FileTest.file?</code> or <code>FileTest.directory?</code>.
 
<syntaxhighlight lang="ruby">File.file?("input.txt")
Line 2,645:
["docs", "/docs"].each { |d|
printf "%s is a directory? %s\n", d, File.directory?(d) }</syntaxhighlight>
 
=={{header|Run BASIC}}==
<syntaxhighlight lang="runbasic">files #f,"input.txt"
1,149

edits