Reputation: 19
I'm completely new to c# and have learned that the code
var result = "Apples" != "Oranges";
Console.WriteLine(result);
would give a result of 'true', but the output wouldn't show up and for that I learned that you needed to use the Console.ReadLine
.
Though, I got an error: CS0201 Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement and don't know what the problem is, does anyone have an answer?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test
{
class Program
{
static void Main(string[] args)
{
var result = "Apples" != "Oranges";
Console.WriteLine(result);
Console.ReadLine;
}
}
}
Upvotes: 0
Views: 78
Reputation: 1338
As crashmstr said, you need to put Console.ReadLine(); as a method call in your line. Otherwise, the compiler is confused what you're trying to do with the ReadLine method. Method's require ().
Upvotes: 1