<!-- Hello, Tin · Tin · https://tin.ad/docs/tour/hello/ · generated from the built page -->

[Tour](https://tin.ad/docs/tour/) · 1 of 8

# Hello, Tin

A program is a file with a `main`. Strings interpolate, and everything is an expression.

*examples/01-hello.tin · tin run examples/01-hello.tin*

```tin
// The smallest Tin program. Run it with:  tin run examples/01-hello.tin

fn main() {
  let name = "Tin"
  print("Hello from {name}!")
  print("2 + 2 = {2 + 2}")
}
```

<!-- output -->
```text
Hello from Tin!
2 + 2 = 4
```

`let` binds a value that never changes; `var` binds one that can.
Types are inferred, so you write them where they help a reader, not where the compiler needs them.
Anything inside `{…}` in a string is evaluated and printed.

`if` is an expression, so it can sit on the right of a `let` or inside a string.
Functions with a single expression use `=>`.

*examples/02-fizzbuzz.tin · tin run examples/02-fizzbuzz.tin*

```tin
// Functions, ranges, and `if` as an expression.

fn fizzbuzz(n: int): string {
  if n % 15 == 0 { "FizzBuzz" }
  else if n % 3 == 0 { "Fizz" }
  else if n % 5 == 0 { "Buzz" }
  else { str(n) }
}

fn main() {
  for i in 1..16 {
    print(fizzbuzz(i))
  }
}
```

<!-- output -->
```text
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
```
