+ 1

Can somebody help me with if statement

my Problem is that i want to check if the person has typed 25 and if it is true it should display the sentence below can somebody maybe help me im lost D; static void Main(string[] args) { int X = 12; int Y = 13; Console.WriteLine("Hello,what is your name?"); string Z = Console.ReadLine(); Console.WriteLine("Hello,{0}.", Z); Console.WriteLine("{0}, what is {1} + {2} ", Z, X, Y); int Result = Convert.ToInt32(Console.ReadLine()); if (Result = 25) { Console.WriteLine("Good job the answer is right! its" + Result); } Console.ReadLine(); }

3rd Nov 2017, 9:52 PM
Lucas__101
Lucas__101 - avatar
5 Réponses
+ 6
To compare two objects, you use ==, if you use =, you assign a value to a variable.
3rd Nov 2017, 9:54 PM
Jonas Schröter
Jonas Schröter - avatar
+ 2
No problem 😊
3rd Nov 2017, 10:01 PM
Jonas Schröter
Jonas Schröter - avatar
+ 2
Next time : Put the language of your question in the tags. You had a good question.
3rd Nov 2017, 11:01 PM
sneeze
sneeze - avatar
+ 1
OMG thank you, you saved me xD!
3rd Nov 2017, 9:59 PM
Lucas__101
Lucas__101 - avatar
+ 1
oh okay thanks for the reminder
3rd Nov 2017, 11:03 PM
Lucas__101
Lucas__101 - avatar