Jump to content

Check that file exists: Difference between revisions

Haskell example added
(→‎{{header|SmallTalk}}: sp; formatting)
(Haskell example added)
Line 49:
}
}
 
=={{header|Haskell}}==
 
import System.IO
import System.Directory
check :: (FilePath -> IO Bool) -> FilePath -> IO ()
check p s = do
result <- p s
putStrLn $ s ++ if result then " does exist" else " does not exist"
main = do
check doesFileExist "input.txt"
check doesDirectoryExist "docs"
check doesFileExist "/input.txt"
check doesDirectoryExist "/docs"
 
=={{header|MAXScript}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.