Skip to main content

Quick tour

This quick tour of Snapi shows how to build two programs, step-by-step.

  • Example 1 - Building a simple program
  • Example 2 - Reading and joining data

To create a Snapi program, start by creating an expression such as:

"Hello world!"

Let's now create a top-level declaration called main and call it:

main() = "Hello world!"

main() // Calling the declaration above. Result is "Hello world!"

Now let's add an argument to the declaration:

main(name: string) = "Hello " + name + "!"

main("world") // Result is "Hello world!"

Let's make the declaration optional:

main(name: string = "world") = "Hello " + name + "!"

main() // Result is "Hello world!"

But you can also call it as:

main(name: string = "world") = "Hello " + name + "!"

main("John") // Result is "Hello John!"