filmov
tv
Relational Operators in C# - C# Tutorial 19
Показать описание
Notes for You:: Relational Operators in C# - C# Tutorial 19
- are also known as comparison operators.
- re used to compare the relationship between two values;
- on comparison they yield the result either true or false.
- There are 6 relational or comparison operators in C#. They are
< : less than
> : greater than
<= : less than or equal to
>= : greater than or equal to
== : equal to
!= : not equal to
Note:
- OR says if both LHS & RHS operands are false then the result will be false; otherwise the result will be true
Example Code:
using System;
namespace RelationalOperatorsDemo
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(3 < 4); // True
Console.WriteLine(5 < 4); // False
Console.WriteLine(5 > 4); // True
Console.WriteLine(5 > 6); // False
Console.WriteLine(5 <= 6); // True
Console.WriteLine(6 <= 6); // True
Console.WriteLine(7 <= 6); // False
Console.WriteLine(7 >= 6); // True
Console.WriteLine(7 >= 7); // True
Console.WriteLine(7 >= 8); // False
Console.WriteLine(7 != 8); // True
Console.WriteLine(7 == 8); // False
Console.ReadKey();
}
}
}
Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.
=========================================
Follow the link for next video:
Follow the link for previous video:
=========================================
C# Tutorials Playlist:-
=========================================
Watch My Other Useful Tutorials:-
C++ Tutorials Playlist:
Java Tutorials Playlist:-
C Programming Tutorials Playlist:
C Practical LAB Exercises Playlist:-
=========================================
► Subscribe to our YouTube channel:
► Visit our Website:
=========================================
Hash Tags:-
#ChidresTechTutorials #CSharp #CSharpTutorial #CHash #CHashTutorial
- are also known as comparison operators.
- re used to compare the relationship between two values;
- on comparison they yield the result either true or false.
- There are 6 relational or comparison operators in C#. They are
< : less than
> : greater than
<= : less than or equal to
>= : greater than or equal to
== : equal to
!= : not equal to
Note:
- OR says if both LHS & RHS operands are false then the result will be false; otherwise the result will be true
Example Code:
using System;
namespace RelationalOperatorsDemo
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(3 < 4); // True
Console.WriteLine(5 < 4); // False
Console.WriteLine(5 > 4); // True
Console.WriteLine(5 > 6); // False
Console.WriteLine(5 <= 6); // True
Console.WriteLine(6 <= 6); // True
Console.WriteLine(7 <= 6); // False
Console.WriteLine(7 >= 6); // True
Console.WriteLine(7 >= 7); // True
Console.WriteLine(7 >= 8); // False
Console.WriteLine(7 != 8); // True
Console.WriteLine(7 == 8); // False
Console.ReadKey();
}
}
}
Note:
- replace < with less-than symbol.
- replace > with greater-than symbol.
=========================================
Follow the link for next video:
Follow the link for previous video:
=========================================
C# Tutorials Playlist:-
=========================================
Watch My Other Useful Tutorials:-
C++ Tutorials Playlist:
Java Tutorials Playlist:-
C Programming Tutorials Playlist:
C Practical LAB Exercises Playlist:-
=========================================
► Subscribe to our YouTube channel:
► Visit our Website:
=========================================
Hash Tags:-
#ChidresTechTutorials #CSharp #CSharpTutorial #CHash #CHashTutorial
Комментарии