Lesson contents

Test boundary values

Try a value just below the limit and then the limit itself. The two answers show whether the boundary belongs inside or outside the rule.

Simple example

Check one below and exactly at three.

Start2 and 3 · limit 3
Resultfalse true
main.swift
print(2 >= 3)
print(3 >= 3)
Output
false
true
Advertisements

Everyday examples

A free ticket starts at ten visits. Check a card with nine visits and a card with ten.

Start9 and 10 · limit 10
Resultfalse true
main.swift
print(9 >= 10)
print(10 >= 10)
Output
false
true
Run the example
Terminal
swift main.swift
Official documentation