Elkish
New member
- Joined
- Feb 28, 2024
- Messages
- 1
- Programming Experience
- Beginner
I'm having a small bit of trouble with this line of code:
I'm attempting to create a password lock but I cant figure out how if statments work with user input
C#:
/*the first
three lines
had info abt the website*/
using System;
public class HelloWorld
{
public static void Main(string[] args)
{
string name = Console.ReadLine();
if (name = "John");
{Console.WriteLine("Hello");
}
}
}
/* Output is as follows: /tmp/x5zYDaeba9.cs(11,9): error CS0029: Cannot implicitly convert type 'string' to 'bool'
/tmp/x5zYDaeba9.cs(11,23): warning CS0642: Possible mistaken empty statement*/
I'm attempting to create a password lock but I cant figure out how if statments work with user input
Last edited: