C# 3 Different Variables and Input

Hello, I am new to C# and was hoping to get some feedback on my code. I'm trying to make this an interactive program by the three response variables. Your help is greatly appreciated. using System; namespace ConsoleApp1 { class Program { static void Main(string[] args) { Console.WriteLine("What is your name?"); var v1 = Console.ReadLine(); Console.WriteLine("Hello " + v1); Console.WriteLine("Do you like programming?"); var v1 = Console.ReadLine(); if v1 = ("yes"); Console.WriteLine("That's awesome!"); if v1 == ("no"); Console.WriteLine("Why?"); Console.ReadLine(); if v1 == ("maybe"); Console.WriteLine("You must be kidding me!");

7/21/2018 11:19:10 PM


1 Answer

New Answer


add "else" before the last two if statements, no need to check if the input is "no" if we've already established it's "yes". also you need brackets surrounding the entire if statement, not just the string you're comparing to.