Reputation: 71
if (Console.CursorTop=3 && Console.CursorLeft==7) {
Console.WriteLine();
}
there is an error
Error 1 Operator '&&' cannot be applied to operands of type 'int' and 'bool'
Why is it not working?
Upvotes: 2
Views: 27070
Reputation: 6568
In C# = is not used for comparison of two values. In order to make a comparison between two values you need to put == in your statement.
if (Console.CursorTop**==**3 && Console.CursorLeft==7) {
Console.WriteLine();
}
Upvotes: 1
Reputation: 1015
If you are trying to compare CursorTop to 3 then you need if (Console.CursorTop==3 && Console.CursorLeft==7)
Upvotes: 2
Reputation: 6561
Correct your syntax, replace =3 with ==3
if (Console.CursorTop==3 && Console.CursorLeft==7)
{
Console.WriteLine();
}
Upvotes: 3
Reputation: 190945
Don't you mean (notice the double equal signs)
Console.CursorTop == 3
other wise its an assignment.
Upvotes: 12