Chapter 1: First steps

Hello, World!

  • def
  • echo

Every Bea program starts at a public function called main. Functions are declared with def, and pub makes one visible outside its module.

echo prints any value along with the file and line it came from, which makes it the quickest way to look inside a program. It is Gleam's echo, unchanged.

Switch to the Gleam tab: the only difference is def becoming fn. Bea is Gleam with a different surface, so that is what most of this tour will keep showing you.

Open in playground
pub def main() {
  echo "Hello, World!"
}

An exercism exercise from the Gleam track, solved in Bea: beacode/src/e1_hello_world.bea