How to resolve the algorithm Check that file exists step by step in the Factor programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Check that file exists step by step in the Factor programming language

Table of Contents

Problem Statement

Verify that a file called     input.txt     and   a directory called     docs     exist.

This should be done twice:

Optional criteria (May 2015):   verify it works with:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Check that file exists step by step in the Factor programming language

Source code in the factor programming language

: print-exists? ( path -- )
    [ write ": " write ] [ exists? "exists." "doesn't exist." ? print ] bi ;

{ "input.txt" "/input.txt" "docs" "/docs" } [ print-exists? ] each


  

You may also check:How to resolve the algorithm Comments step by step in the Prolog programming language
You may also check:How to resolve the algorithm Pascal matrix generation step by step in the R programming language
You may also check:How to resolve the algorithm Maximum triangle path sum step by step in the Stata programming language
You may also check:How to resolve the algorithm Modular exponentiation step by step in the Pascal programming language
You may also check:How to resolve the algorithm Text processing/Max licenses in use step by step in the Ada programming language