using System; class Eggs { public static void Main() { Console.WriteLine("Enter amount of eggs: "); string numberEggs = Console.ReadLine(); Console.WriteLine("Amount of eggs are: ", + numberEggs); } } The start of my code. There's much more to add to it but yeah, first I need to get past this obstacle which the console is throwing out for me in VS Code. If anyone can help, I'd appreciate it a lot.
error CS0023: Operator '+' cannot be applied to operand of type 'string'
I have no idea how to fix this. I try to push it for an int instead of a string, then I get this:
error CS0029: Cannot implicitly convert type 'string' to 'int'
https://stackoverflow.com/questions/66837773/operator-cannot-be-applied-to-operand-of-type-string March 28, 2021 at 09:59AM
没有评论:
发表评论