// SPDX-License-Identifier: CC-BY-SA-4.0
= AffineScript Warmup Scripts
:toc:
:icons: font

Short, focused AffineScript programs for building muscle memory before reading
the full link:../frontier-guide.adoc[Frontier Guide].

Each script is self-contained and has inline exercises to try.

== How to use

[source,bash]
----
# Parse only (syntax check):
affinescript parse 01_basics.affine

# Type check:
affinescript check 02_ownership.affine

# Evaluate (for scripts that produce output):
affinescript eval 01_basics.affine
----

== Warmup sequence

[cols="1,3"]
|===
| Script | Covers

| link:01_basics.affine[01_basics.affine]
| Let bindings, literals, functions, pattern matching

| link:02_ownership.affine[02_ownership.affine]
| `own`/`ref`/`mut`, `@linear`/`@erased`, `Option`/`Result`

| link:03_effects.affine[03_effects.affine]
| Effect declarations, effect composition, effect polymorphism

| link:04_rows.affine[04_rows.affine]
| Row-polymorphic records, row type aliases, spread syntax
|===

== For bot / agent guidance

When using an AI agent to learn AffineScript interactively, point the agent at
these files in order.  Each file ends with numbered exercises — a suitable
prompt is:

____
"Complete exercise 1 in this warmup.  If the compiler accepts it, move on.
If it rejects it, read the error and try to understand what rule was violated
before looking it up."
____

The exercises are deliberately constraint-based: success is learning to work
within the type system, not producing output as quickly as possible.
