To add to what TheRealSteveJudge said: you are not using brackets properly anyway.
Console.WriteLine("whats 9+45?");
{
if (Answer == 54);
{ Console.WriteLine("{0} {1} is Smart! :D ");
} <=====
else
{ Console.WriteLine("{0} {1} isn't so Smart :( ");
}
Console.WriteLine("Press Enter to Close");
Button = Console.ReadLine();
}
You don't need the outer set brackets here - they don't serve any purpose. You only use them when you are "grouping together" statements to be executed - in a method for example, a loop, or a conditional statement. Adding them "at random" doesn;t make your code more readable!
As a beginner, use them for every conditional, and indent your code:
static void Main(string[] args)
{
Console.WriteLine("what is your name?");
string Name = Console.ReadLine();
Console.WriteLine("what is your family name?");
string Family = Console.ReadLine();
int Answer = 54;
Console.WriteLine("whats 9+45?");
if (Answer == 54)
{
Console.WriteLine("{0} {1} is Smart! :D ");
}
else
{
Console.WriteLine("{0} {1} isn't so Smart :( ");
}
Console.WriteLine("Press Enter to Close");
string Button = Console.ReadLine();
}
Or like this:
static void Main(string[] args)
{
Console.WriteLine("what is your name?");
string Name = Console.ReadLine();
Console.WriteLine("what is your family name?");
string Family = Console.ReadLine();
int Answer = 54;
Console.WriteLine("whats 9+45?");
if (Answer == 54)
{
Console.WriteLine("{0} {1} is Smart! :D ");
}
else
{
Console.WriteLine("{0} {1} isn't so Smart :( ");
}
Console.WriteLine("Press Enter to Close");
string Button = Console.ReadLine();
}
Note that I moved the definition of variables to where you are going to use them - that just makes it easier to see what is going on when you actually use them. With small methods like this, that doesn't make a lot of difference, but as they grow it becomes a pain to wade back through pages of code to find the definition. It also prevents you using them when they are "out of scope" and the error messages that causes.
In addition, names of local variables should start with lower case:
static void Main(string[] args)
{
Console.WriteLine("what is your name?");
string name = Console.ReadLine();
Console.WriteLine("what is your family name?");
string family = Console.ReadLine();
int answer = 54;
...
And your next problem is your WriteLine statements:
Console.WriteLine("{0} {1} is Smart! :D ");
}
else
{
Console.WriteLine("{0} {1} isn't so Smart :( ");
}
You tell the writeline to include variable values, but you don't supply the variables! Either do this:
Console.WriteLine("{0} {1} is Smart! :D ", name, family);
}
else
{
Console.WriteLine("{0} {1} isn't so Smart :( ", name, family);
}
Or this
Console.WriteLine($"{name} {family} is Smart! :D ");
}
else
{
Console.WriteLine($"{name} {family} isn't so Smart :( ");
}
If you are using a recent version of Visual Studio.