Whole numbers and their widths
You will learn
The integer types, their ranges, and the error a value too big for its type gets.
A u in the type name means unsigned, an i means signed, and the digits are the number of bits. u8 holds 0 to 255, u16 holds 0 to 65535, i32 holds negative numbers too. The compiler checks a constant against its type: give a u8 the value 300 and it stops with an error that says no u8 can hold 3 digits. The browser's checker is lenient elsewhere, so do not read its silence as proof.
Try it
Set BYTE_MAX to 300 in the player and read the error the compiler prints.

u8, u16, u32 and i32 with their bit counts and ranges, and the error t27c gives a value too big for its type. Lesson 5 of the t27 basics course.
specs/basics/05_whole_numbers.t27
// SPDX-License-Identifier: Apache-2.0
; t27 basics, lesson 5: Whole numbers and their widths.
; u8, u16, u32 and i32: how many bits a number has decides which values it can hold.
module basics_05_whole_numbers;
pub const BYTE_MAX : u8 = 255;
pub const WORD_MAX : u16 = 65535;
pub const SMALL_NEG : i32 = -5;
test wider_types_hold_more {
assert WORD_MAX > BYTE_MAX;
assert BYTE_MAX == 255;
assert SMALL_NEG < 0;
}
All lessons
Module 1 · A spec file
What a .t27 file holds: a module line, prose lines and comments.
Module 2 · Values and types
Constants, the width of a whole number, and true, false and text.
Module 3 · Arrays, trits and expressions
Lists of values, the three values of a trit, and what operators compute.
Module 4 · Tests and functions
A test block, several small tests in one spec, and a function with typed inputs.
Module 5 · Inside a function
Names with let and var, choices with if and switch, and loops.
Module 6 · Visibility and your own types
What pub shares with other modules, and the structs and enums you declare.
Module 7 · Modules, rules and gen-ts
Reading another module, stating a rule that always holds, and a spec turned into TypeScript.
Module 8 · The compiler and tri
The backends t27c writes, the stages it reads a spec in, and the tri command.
Module 9 · Errors, a program, what next
Reading a compiler error, one small complete program, and the course to take next.