Skip to content

Learn Norm ​

Each lesson introduces one feature through a runnable program, its checked output, an explanation, and one change to try. Follow the order for a gradual start, or open a specific topic.

The full learning path is checked against the development toolchain. Use Status and the version index to check the capabilities of an installed release.

Write and run a program ​

LessonNew feature
01 Program entryStart a single-file program with main()
02 Explicit types and assignmentDeclare and update typed variables
03 Type inferenceLet an initializer determine a local type
04 String interpolationPlace expressions inside strings
05 Operators and comparisonsCompute numbers and Boolean results
06 Conditional executionChoose a block with if/else

Organize calculations with functions ​

LessonNew feature
07 Functions and explicit returnsName a calculation and return its result
08 Named argumentsBind call values to parameter labels
09 Default argumentsOmit an argument with a declared default
10 Argument shorthandReuse matching local and parameter names
11 if as a resultReturn a value from either branch
12 Final-expression returnsUse the last expression as a function result

Work with collections and control flow ​

LessonNew feature
13 ListsA list stores an ordered sequence whose length can change.
14 IterationUse for to visit each element without managing an index yourself.
15 Conditional loopsA condition-style for repeats while its Boolean condition remains true.
16 BreakA valueless break leaves the current statement loop immediately.
17 Continuecontinue skips the rest of one iteration and proceeds to the next.
18 ArraysAn array is indexed like a list but keeps a fixed length.
19 MapsA map associates a typed key with a typed value.
20 SetsA set keeps distinct elements and answers membership queries.
21 Collection value semanticsAssigning a built-in collection gives the new binding an independent container value.
22 Collection for elementsA collection literal can generate elements from another iterable.
23 Collection if elementsA collection literal can include an element only when a condition holds.
24 Spread in collections... inserts the elements of an iterable at one position in a collection literal.

Model values and entities ​

LessonNew feature
25 Value declarationsA value groups immutable fields into a typed data value.
26 Value equalityValues compare by their contents rather than by creation event.
27 Class declarationsA class models an entity with fields and behavior that can change.
28 Class identityClass variables can refer to the same entity or to distinct entities with equal-looking fields.
29 Copying a classCall copy() when a new top-level class identity is needed.
30 Explicit constructorsA class can replace implicit field construction with a same-named constructor.
31 Computed propertiesA computed property presents accessor behavior with field-like syntax.
32 Fluent methodsA method may return this so the caller can continue operating on the same object.

Handle absence and match states ​

LessonNew feature
33 Nullable valuesA ? on a type permits null; the type without ? does not.
34 Flow narrowingA null check can prove a nullable value non-null inside a branch.
35 Safe access?. reads a member only when its receiver exists.
36 Null fallback?? uses its right operand only when the left operand is null.
37 Plain enumsAn enum lists a finite set of named alternatives.
38 Data enumsEnum alternatives may carry differently typed data.
39 Switch resultsswitch can produce a result while extracting an enum variant's payload.
40 Exhaustive matchingA switch over a closed enum must account for every variant.
41 Nested patternsA pattern may match a variant inside another variant's payload.

Compose abstractions ​

LessonNew feature
42 Interface declarationsSpecify a callable contract.
43 Implementing an interfaceProvide the required behavior.
44 Default interface methodsShare behavior in the contract.
45 Class inheritanceExtend a class and initialize its base.
46 Overriding methodsDispatch to a subclass implementation.
47 Generic typesParameterize a data type.
48 Generic functionsParameterize a calculation.
49 Generic inferenceInfer type arguments from call values.
50 Matching generic typesDistinguish generic instantiations at runtime.
51 Function overloadsSelect a signature by argument type.

Functions as values ​

LessonNew feature
52 Function valuesStore and pass callable values.
53 LambdasCreate a function value at its use site.
54 Capturing valuesKeep access to an enclosing value.
55 Bound method referencesBind a callable to an object.
56 Extension functionsCall a static function through receiver syntax.
57 Trailing callbacksSupply a final callback as a block.
58 Named callback parametersName a callback's supplied value.
59 Chaining block callsCompose functions with trailing blocks.

Build a project ​

LessonNew feature
60 ImportsUse a public declaration from another package.
61 ModulesDescribe a module's name, version, and exports.
62 PackagesGive source files structured names.
63 VisibilitySeparate public API from file-private details.
64 Local dependenciesConsume a packaged library through the module graph.
65 TestsDeclare and run a test.
66 Exception handlingCatch exceptional control flow.
67 Cleanup with finallyRun cleanup on every exit.

Describe declarations ​

LessonNew feature
68 Type declaration referencesRead type metadata through a checked declaration.
69 Field declaration referencesRead and write a field through its descriptor.
70 Function declaration referencesUse a checked callable declaration reference.
71 Annotation targetsRestrict where an annotation may appear.
72 Annotation retentionChoose how long annotation data remains available.
73 Runtime annotation metadataRead a runtime-retained annotation.
74 Function interceptionWrap a function call with around.
75 Interceptor entry and exitObserve before, body, and after order.
76 Documenting declarations for agentsExpose checked intent through @Document and query.

Observe and build ​

LessonNew feature
77 Lexical referencesBorrow a writable local location.
78 Field handlesBind a field descriptor to an object.
79 Field subscriptionsWatch assignments and close a subscription.
80 Collection change notificationsWatch collection mutations through a field.
81 Resource ownershipRegister and release owned subscriptions.
82 Result buildersAccumulate expressions into a result.
83 Control flow in result buildersAccumulate selected branches and loop iterations.

Use libraries ​

LessonNew feature
84 JSON value roundtripEncode and decode a checked value.
85 Writing and reading a fileClaim a new file and read it back.
86 Typed file failuresHandle a missing file by failure category.
87 A packaged libraryConsume an external library through a direct dependency.

For a complete GUI Todo and Web guestbook, use the generated norm hello programs with the development toolchain.

The Language Reference defines precise rules; Status describes released capabilities.

Start with Program entry.

Norm 0.24 development line