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 ↗

Your first run

Start with something you can see immediately. This program returns a number. It does not print to a terminal or contact a service; its result is the value the caller receives.

Try it · Your first run
main.flow
pub flow main() -> Int = 21 * 2
Expected result42

Read the line from the outside in

The name main identifies a function. flow declares it, and pub makes it public so it can be chosen as the run's entry. The empty parentheses mean it takes no input. -> Int says its result is an integer. After = comes the expression that computes the result.

There is no separate return statement here. The expression 21 * 2 is the body, so its value is the function's value.

Choose Edit this example, then Run. You should see 42. Change a number and run again. That second result comes from your edited source, not from the example printed above it.

Make a useful mistake

Replace 21 with the text "twenty-one". Run the program. The compiler tells you that the multiplication does not accept those values. Restore the number and run again.

An error is information about this source. You can experiment without losing the original: Reset restores the lesson's files and input.

Before you move on

Try the exercise beneath the editor: make the program return 84. The exercise checks the result, so you can choose your own expression. The next chapter replaces a value you can compute with one that comes from outside the program.

Exact rules: functions and evaluation, data types.