C# Foundations · Lesson 5

Conditions

A comparison is true or false, and if picks a path from that.

How it works

price >= 10m is true for 12 and false for 8. The true branch prints keep. The else branch prints skip. The boundary value 10 stays in the true branch because the operator is >=, not >. Later, Where uses the same comparison to keep prices.

A working example

var price = 12m;
if (price >= 10m)
{
    Console.WriteLine("keep");
}
else
{
    Console.WriteLine("skip");
}

Expected output

keep
Try this
>= keeps the boundary value.