t27.aiРусский

The module line

You will learn

How to write the module line, which names it accepts, and where it goes.

The module line is the keyword module, a name and a semicolon. Comment and prose lines may come before it; declarations come after. Names use letters, digits and underscores; the compiler in this site also accepts hyphens, as in tutorial-06-structs. A course spec on this site must use the module name its generator expects, so a wrong name is caught by the build and not by the compiler.

Try it

In the player, change the module name of this lesson spec and watch the verdict stay clean.

Open the interactive lesson →

t27 basics 2: the module line
t27 basics 2: the module line ↗

Which module lines the t27c compiler accepts, checked in the browser with the real compiler. Lesson 2 of the t27 basics course.

specs/basics/02_the_module_line.t27

// SPDX-License-Identifier: Apache-2.0
; t27 basics, lesson 2: The module line.
; Every spec names its module once, with module, a name and a semicolon.

module basics_02_the_module_line;

pub const LESSON : u8 = 2;

test the_module_line_names_this_file {
    assert LESSON == 2;
}

Open the lesson's spec in the player ↗

All lessons