Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the relational operator of C #

Shulou Source: shulou.com Published: 2022-06-01 02:06:38 09月25日 Update

This article mainly explains "how to use the relational operator of C #". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Let's follow the editor's train of thought to study and learn how to use the relational operator of C#.

Example

Take a look at the following example for all the relational operators available in C#:

Using System

Class Program

{

Static void Main (string [] args)

{

Int a = 21

Int b = 10

If (a = = b)

{

Console.WriteLine ("Line 1-an equals b")

}

Else

{

Console.WriteLine ("Line 1-an is not equal to b")

}

If (a b)

{

Console.WriteLine ("Line 3-an is greater than b")

}

Else

{

Console.WriteLine ("Line 3-an is not greater than b")

}

/ * change the values of an and b * /

A = 5

B = 20

If (a = a)

{

Console.WriteLine ("Line 5-b is greater than or equal to a")

}

}

}

When the above code is compiled and executed, it produces the following results:

Line 1-an is not equal to bLine 2-a not less than bLine 3-a greater than bLine 4-a less than or equal to bLine 5-b greater than or equal to a thank you for reading, the above is the "C # relational operator how to use" the content, after the study of this article, I believe that you have a deeper understanding of how to use the relational operator of C#, the specific use of the situation also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Operators caching operations learning content examples facets code that is ideas situations articles more knowledge knowledge points articles results please see follow questions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Docker Apple Linux macOS