Member Avatar

sanjeewa.abeywardana

How can I convert this code to csharp code, seems to be simple but little confused.

Dim Temperature As Integer = 30   

   Select Case Temperature
                Case 31
                    Console.WriteLine("stay in bed")
                Case 32
                    Console.WriteLine("play the lottery")
                Case Else
                    Console.WriteLine("Just read the newspaper")
    End Select
Member Avatar

sanjeewa.abeywardana

how silly of me to write like this

     int Temperature= 30;

                switch (Temperature)
                {
                    case 31:
                        Console.WriteLine("stay in bed");
                        break;
                    case 32:
                        Console.WriteLine("play the lottery");
                        break;
                    defualt:
                        Console.WriteLine("Just read the newspaper");
                }

    Console.Read();
see, what's wrong? , just for fun find it :-) , LOL...
Member Avatar

sanjeewa.abeywardana

ok , it's the default in line 11 , it is wrong