+ 1

What is the mistake please

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { Console.WriteLine ("Enter password"); int password = Convert.ToInt32(Console.ReadLine()); if (password = 4) { Console.WriteLine("correct password " + "hi again it's to see you again"); } else { Console.WriteLine("incorrect password"); } } } }

5th Jun 2020, 2:23 PM
Ahmad Adel
Ahmad Adel - avatar
3 odpowiedzi
+ 2
The if statement has to have to ==
5th Jun 2020, 2:24 PM
Alexandre
Alexandre - avatar
+ 2
if (password==4) instead of if(password=4)
5th Jun 2020, 2:39 PM
Alexandre
Alexandre - avatar
+ 2
No problem :)
5th Jun 2020, 2:50 PM
Alexandre
Alexandre - avatar