Expressions
You will learn
Arithmetic operators and comparisons on the lesson constants, and the bool a comparison gives back.
An expression combines names and numbers with operators. With A = 17 and B = 5, A + B is 22, A - B is 12, A * B is 85, A / B is 3 because whole numbers divide without a fraction, and A % B is 2, the remainder. Comparisons give true or false. One limit of the test runner on this site: it does not read a minus sign in front of a number, so write negative values as constants.
Try it
Change B to 4 and predict each of the five results before you run the tests.

Every arithmetic and comparison operator of a t27 test, applied to 17 and 5 by the lesson spec. Lesson 9 of the t27 basics course.
specs/basics/09_expressions.t27
// SPDX-License-Identifier: Apache-2.0
; t27 basics, lesson 9: Expressions.
; Arithmetic and comparison operators, and what a test can compute with them.
module basics_09_expressions;
pub const A : u8 = 17;
pub const B : u8 = 5;
test arithmetic_on_whole_numbers {
assert A + B == 22;
assert A - B == 12;
assert A * B == 85;
assert A / B == 3;
assert A % B == 2;
}
test comparisons_give_true_or_false {
assert A > B;
assert B <= A;
assert A != B;
}
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.