+ 1
C# Beginner question
Hello, can someone please help me with this. I'm getting a compiling error. I'm running it in Visual Studio. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp9 { class Program { static void Main(string[] args) { double height = 4.0; if(height >= 5.0) { Console.WriteLine("you are tall enough"); else Console.WriteLine("you are too short!"); }
2 Respuestas
+ 2
The problem is that the else statement is inside the if block, when you put it outside and close off the class and namespace curly brackets the application should compile flawlessly. Next time put your code in a C# code on Sololearn and link it to make it easier for us to help you.
+ 2
Error on the writing of blocks.
if(height >= 5.0)
{
Console.WriteLine("you are tall enough");
}
else
{
Console.WriteLine("you are too short!");
}