C
C#12mo ago
Jeb

✅ HELP

I recentyl started to experiment a bit with C# and I ran into an error in my code please help. Im using visual studio 2019 btw. Error is "Cannot implicitly conver string to bool". Thanks. ------------------ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace c_sharp { class Program { static void Main(string[] args) { Console.Title = "Yi Lan Ma"; Console.WriteLine("Hai everyvan aj em Yi Lan Ma."); Console.WriteLine("Du ju want to buy a nukler wepon?"); string Response = Console.ReadLine();
if (Response = "Yes") { Console.WriteLine("Perfekt, Zat vil be 69 dolars."); } Console.ReadKey(); } } }
--------------- string Response = Console.ReadLine();
These two lines are causing the error. if (Response = "Yes")
4 Replies
jcotton42
jcotton4212mo ago
so first use $code in the future to format your code
MODiX
MODiX12mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat For longer snippets, use: https://paste.mod.gg/
jcotton42
jcotton4212mo ago
seoncd, you used = which assigns you wantetd == which does an equality check
Jeb
JebOP12mo ago
ohhhh works now tysm
Want results from more Discord servers?
Add your server