Les conditions

Documentation officiel

Instruction if

int a = 8;
if (a % 2 == 0)
{
    Console.WriteLine("Pair");
}
else
{
    Console.WriteLine("Impair");
}

Instruction switch-case

int a = 42;
switch (a)
{
    case 42:
        Console.WriteLine($"21*2");
        break;

    case 1337:
        Console.WriteLine("L33t");
        break;

    case > 69:
        Console.WriteLine("Nice!");
        break;

    default:
        Console.WriteLine($"{a} ne correspond a rien ici");
        break;
}