# Getting started

Install the compiler, write one file, run it. Vyrn needs no project file and no build step for a single program.

## Install and check

Install the compiler with the script for your platform. The [install page](https://vyrn-lang.github.io/install.html) has both, and both verify the archive against the release checksums before they unpack anything.

Then run a file. `vyrn run` compiles the program to WebAssembly and runs it, and needs nothing else on your machine. `vyrn build --target wasm` writes that module. `vyrn build` puts the same bytes through `wasm2c` and `clang` into a native binary.

Both are the same program. The route harness runs every example both ways and compares the bytes, so a program that runs as wasm runs the same way as a binary.

## Your first program

A program is a file. `main` returns the exit code, and `print` writes one line to standard output.

Every program in this book has the same shape: a `demo` function that answers with the text, and the `main` that prints it. That is not a language rule. Follow the run link to open the same source in the playground.

```vyrn
// `demo` answers with the text. `main` below prints it and returns the exit code.
export fn demo() -> String {
    return "hello, world"
}

fn main() -> Int64 {
    print(demo())
    return 0
}
```

Built output:

```
hello, world
```

## Functions, parameters, results

A function states the type of each parameter and the type it returns. Nothing is inferred across a function boundary, so a signature is the whole contract.

`\{ }` inside a string puts a value into it. The value is converted where it is written, not by a format string somewhere else.

```vyrn
// A function takes typed parameters and returns a typed result. `\{...}` puts a
// value into a string.
fn area(width: Int64, height: Int64) -> Int64 {
    return width * height
}

export fn demo() -> String {
    let w = 3
    let h = 4
    return "\{w} by \{h} is \{area(w, h)}"
}

fn main() -> Int64 {
    print(demo())
    return 0
}
```

Built output:

```
3 by 4 is 12
```

---

From https://vyrn-lang.github.io/guide/getting-started.html — generated by `site/export.vyrn` from the Vyrn repository.
