DAVE DOCUMENTATION

Documentation.

Dave programs use ordinary words in a strict, consistent order. Each complete statement ends with a period.

Getting started

Open Try Dave, select an example, and press Run. Dave checks each statement and shows the resulting screen or output. A statement that does not match a supported form produces a diagnostic.

hello.dave
1Make a screen called "Hello".
2Put a heading at the top of the screen that says "Hello, world".

Putting things on the screen

Start by making a screen. Then put a box, heading, button, or text on it. Quoted text appears in the resulting interface.

signin.dave
1Make a screen called "Sign In".
2Put a box on the screen that says "Password".
3Put a button underneath the password box that says "Enter".

The button is placed relative to the password box named by the statement.

Giving things names

Make a screen called gives the screen a quoted name. You can use that name to identify the screen in the preview. Dave also recognizes a client named Steve in the follow-up example.

names.dave
1Make a screen called "Sign In".
2Steve is a client whose email is "steve@harbourline.co".

Remembering things

A proposition has a value of true or false. Declaring that Dave will keep track of a proposition starts it as false. Remember that changes its value.

state.dave
1We’re going to keep track of whether we’ve heard back from Steve.
2Remember that we’ve heard back from Steve.

Making decisions

If checks a proposition. The action runs only when that proposition is true.

follow-ups.dave
1We’re going to keep track of whether we’ve heard back from Steve.
2If we’ve heard back from Steve, send him the invoice.

Waiting for things to happen

When waits for an event. Put the action on the next line, indented by four spaces. In the playground, use the preview controls to trigger supported events.

events.dave
1When someone presses the button,
2 check the password.
3
4When an email arrives from Steve,
5 remember that we’ve heard back from Steve.

Working with numbers

Dave recognizes signed numbers in a declared list and calculates with the numbers retained from that list.

numbers.dave
1These numbers are 4, -2, 8, and 12.
2From these numbers, keep the ones that are greater than zero.
3Add those numbers together and divide that by how many numbers we kept.

Working with lists

Declare a list of numbers using These numbers are. The statement From these numbers, keep the ones that are greater than zero. produces a new list containing only positive values.

For the list above, Dave keeps 4, 8, and 12. Their average is 8.

A screen can also contain a list. The dashboard example puts today’s appointments underneath its heading.

dashboard.dave
1Make a screen called "Dashboard".
2Put a heading at the top of the screen that says "Good morning".
3Put a list of today’s appointments underneath the heading.
4When someone presses an appointment,
5 show the details of the appointment.

Positioning things

Underneath places one interface element vertically after another. Below describes depth and has a different meaning, so it is not accepted in this construction.

position.dave
1Put a box on the screen that says "Password".
2Put a button underneath the password box that says "Enter".

Common misunderstandings

“Below” and “underneath”

For a button after a password box, use underneath. Dave reports: “Below” changes the depth of something. Did you mean “underneath”?

“When” and “if”

When requires an event. If requires a true or false proposition. Dave reports a specific diagnostic when a proposition is used as an event.

Other statements

If a statement does not match the grammar, Dave reports “Dave didn’t understand that.” The playground accepts only the forms documented here.