dimanche 2 février 2020

C# Switch Case with if statements not returning me the console.WriteLines

I am trying to create a simple switch case with If-Statements code.

Problem:

I don't get any value back.

For Example:

If I put int Temperature = 0; the Code should output "Es ist kalt". But my console doesn't display anything.

using System;

namespace SwitchCase
{
    class Program
    {
        static void Main(string[] args)
        {
            int Temperatur = 25;

            switch (Temperatur)

            {
                    case 1:
                    if (Temperatur <= 0)
                    {
                        Console.WriteLine("Es ist kalt");
                    }
                    break;
                    case 2:
                    if (Temperatur >= 25)
                    {
                        Console.WriteLine("Es ist überdurchschnittlich warm");
                    }
                    break;
                    case 3:
                    if (Temperatur <= 13)
                    {
                        Console.WriteLine("Es ist mild");
                    }
                    break;




            };

        }
    }
}

Aucun commentaire:

Enregistrer un commentaire