Lesson contents

Comparisons

Compare two numbers to answer a yes-or-no question. Equality counts when you use a greater-than-or-equal check.

Simple example

Is three at least two?

Start3 ≥ 2
ResultTrue
Program.cs
using System;

Console.WriteLine(3 >= 2);
Output
True
Advertisements

Everyday examples

A lift has space for four riders. Can all four people waiting board together?

Start4 spaces · 4 people
ResultTrue
Program.cs
using System;

Console.WriteLine(4 >= 4);
Output
True
Run the example
Terminal
dotnet new console --output Lesson
cp Program.cs Lesson/Program.cs
dotnet run --project Lesson
Official documentation