A
A
ALmA113_032020-10-24 13:19:01
C++ / C#
ALmA113_03, 2020-10-24 13:19:01

What is "!="?

I don't understand this line:

if (Row_Text_Box.Text != "" && Col_Text_Box.Text != "")

What does it mean !=?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
E
Evgeny Samsonov, 2020-10-24
@bitniks

!= is an inequality. In this case, checking that Row_Text_Box.Text and Col_Text_Box.Text are not equal to the empty string

C
cicatrix, 2020-10-24
@cicatrix

In C-like languages !=, this is an inequality test. Other languages ​​use <>.
This code will crash with an error if you enter not numbers, but letters in the text fields.
Instead of Convert.ToInt32, you need to use int.TryParse

V
Vasily Bannikov, 2020-10-25
@vabka

The answer is easily found by a search engine

What does != mean in C#

The first link leads to the reference book
TL;DR;
!= is a "not equal" operator and it returns true when the left operand is not equal to the right operand, otherwise false

U
Uncle Bogdan, 2020-11-07
@motkot

Inequality. For example:

int Num = 3;
int Num2 = 3;
if(Num != Num2) {
Console.WriteLine("Переменная Num не равна переменной Num2"); //1
}else {
Console.WriteLine("Переменная Num равна переменной Num2"); //2
}
Console.ReadLine(); // Результат будет 2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question