Member Avatar for 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 for 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 for sanjeewa.abeywardana

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.