Contents · The Flow Book

Start here

The Flow Book1. Your first run2. Let the outside answer3. Keep the original answer

Build the decision

4. Give the program an input5. Name the work6. Give values a shape

Build the workflow

7. Decide what failure means8. Put the decision in its own file9. Put the pieces together

Go further

10. Work on several things11. Leave room for an answer12. Take Flow into an application

Build an application

13. Investigate a real question14. Challenge: diagnose and extend
Language reference ↗

Put the decision in its own file

A workflow file should help you follow the workflow. Move the amount rule into decisions.flow, and let the entry call it by name.

Try it · A file for the decision
main.flow
use "./decisions"

pub flow main(amount: Int) -> Bool = decisions.needs_review(amount)
decisions.flow
pub flow needs_review(amount: Int) -> Bool = amount > 100
Expected resultfalse

One file is one module

use "./decisions" imports a file relative to the importing file. It binds the name decisions. The call decisions.needs_review(amount) tells you both where the function comes from and which function you are using.

The helper writes pub because another module needs to call it. A private helper can still be used inside its own module, but importing the file does not expose its private items.

Edit the owner

Choose the decisions.flow tab. Change the boundary there and check the exercise. The same source bundle includes both files, so Run can resolve the import. A code excerpt that omitted the helper would not be a complete runnable example.

Imports describe the program

Local imports are useful for organizing your own files. Standard-library and remote imports also identify modules, with versions on their repositories. The complete program is resolved and checked before it runs; evaluation does not fetch a new source file halfway through a decision.

Browser lessons use local files and the included standard library. To integrate a remote Tool module, use an application that resolves its sources and supplies its bindings. An import brings in a declaration; it does not establish permission or credentials.

Exact rules: modules and imports.