DOCS / GUIDES

Writing Cluck: a language tour

A quick tour of the Cluck language, from hello world to async eggs.

Beginner18 min read
Before you beginYou need the cluck CLI, a Pollosoft account, and a coop to work in. No prior experience required. Curiosity and a mild fondness for chickens are helpful.

Overview

A quick tour of the Cluck language, from hello world to async eggs. The whole thing takes about 18 minutes, and the commands below are the ones you will use along the way.

$ cluck new hello.cluck
$ cluck run hello.cluck
$ cluck preen hello.cluck

Steps

  1. Hello, coop. A Cluck program starts with bawk. The line bawk "hello" prints hello, loudly.
  2. Variables and eggs. Declare values with lay: lay count = 12. Eggs (immutable values) are the default. Use hatch for mutable state.
  3. Control flow. if, else, and peck-until loops. There is no goto, only goto-the-feeder.
  4. Async eggs. An egg is a value that will exist later. await it with crack. Unresolved eggs do not block the thread.

Commands used

Keep going

Stuck? Check the error codes, the FAQ, or the glossary.