# Foreword

> What this book is, who it is for, how it is organized, and how to read the examples.

Canonical: https://alice-lang.org/documentation/learn/foreword/

[Documentation index](https://alice-lang.org/documentation/llms.txt) · [Complete book](https://alice-lang.org/llms-full.txt)

Alice is a programming language for .NET. You write it like Ruby. The compiler checks it like Rust and runs it close to C. This book teaches the language from the first line of code to parallel programs, native code and packages.

## Who this book is for

You need no prior Alice knowledge. If you have written a little code in any language, you can follow along. If you know Ruby or Crystal, most of the syntax will feel familiar, and [Appendix C](https://alice-lang.org/documentation/learn/from-ruby.md) lists the places where Alice behaves differently. If you know C#, you already know the platform: every Alice type is an ordinary .NET type.

## Why Alice exists

Many languages make you choose. A friendly scripting language is quick to write but slow to run, and its mistakes appear at runtime. A systems language is fast and strict, but you pay for it in ceremony.

Alice tries to keep both halves. The syntax is small and readable. Types are inferred, so you rarely write them. At the same time, the compiler stops a whole family of bugs before the program runs:

- using a value that may be `nil`;
- reassigning a value you declared constant;
- two threads writing the same variable;
- a `case` that forgets a variant;
- a buffer used after it was handed away.

Each of these is a compile error with a code, such as `AL0202` for a data race. You will meet them one at a time, each in the chapter where its idea is introduced.

## How this book is organized

The chapters build on each other. Read them in order the first time.

- **Chapters 1 to 5** teach the basics: tools, a first game, values and functions, collections, and text.
- **Chapters 6 to 8** model data: classes, records, sum types, pattern matching and errors.
- **Chapters 9 to 13** are what makes Alice different: ownership, safety checks, parallelism, performance and proofs.
- **Chapters 14 to 20** connect Alice to the world: .NET libraries, async code, the GPU, native libraries, packages, applications and WebAssembly.
- **Chapters 21 and 22** cover the tools and working with AI coding agents.
- **The appendices** are for looking things up.

Two chapters are projects. In [chapter 2](https://alice-lang.org/documentation/learn/guessing-game.md) you write a guessing game in one sitting. From [chapter 1.3](https://alice-lang.org/documentation/learn/first-project.md) on, you also grow a small program for a tea shop. Each chapter adds a feature to it with what you just learned.

## How to read the examples

Every Alice example in this book is compiled by the book's own test suite with the current compiler. When an example shows output, the test runs the program and compares the output exactly.

Output looks like this:

```alice
puts "Curiouser and curiouser!"
```

```text title="Output"
Curiouser and curiouser!
```

Some examples are wrong on purpose, to show you an error. They are always marked, and the test suite checks that they fail with the error shown:

```alice fail="AL0203"
val size = 3
size = 4
```

```text title="Error"
error[AL0203]: cannot assign to immutable 'size' (declared with val)
```

A few examples need something the test machine cannot provide, such as a GPU, a web server or a NuGet package. Those say so in the text.

Each chapter ends with a **Common mistakes** box, a few **exercises** with answers you can unfold, and a **Summary**.

## What is not covered

Alice is young. The current release is 0.14. Some features are designed but not finished. This book only describes what works today. [Appendix E](https://alice-lang.org/documentation/learn/coming-in-1-0.md) lists what is planned for 1.0, so you know what is coming and what to avoid relying on.

The rest of the documentation is a reference. When you want every option of a feature, follow the links to the [language reference](https://alice-lang.org/documentation/language/programs.md), the [standard library](https://alice-lang.org/documentation/library/collections.md) and the [tools](https://alice-lang.org/documentation/tools/cli.md).

Let's begin by [installing Alice](https://alice-lang.org/documentation/learn/installation.md).

## Continue reading

- Previous: [The Alice book](https://alice-lang.org/documentation/index.md)
- Next: [1.1 Installation](https://alice-lang.org/documentation/learn/installation.md)
