0

Says the word 'Jason' does not exist in the current context, please help me understand why and how to fix.

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) { string yourName; Console.WriteLine("What is your name?"); yourName = Console.ReadLine(); if (yourName=Jason) Console.WriteLine("You're bronze five trash."); else Console.WriteLine("You are a kewl kid"); } } }

24th Mar 2017, 4:05 AM
Scott Lee
Scott Lee - avatar
3 odpowiedzi
+ 17
and always use == for comparison! if (yourName == "Jason")
24th Mar 2017, 6:50 AM
Kamil
Kamil - avatar
+ 16
"Jason" should be written in quotes so that it's a string. Without them, the compiler thinks it's a variable name.
24th Mar 2017, 4:10 AM
Tamra
Tamra - avatar
+ 14
if (yourName. equals("Jason")) is better ^^
24th Mar 2017, 7:27 AM
Tashi N
Tashi N - avatar