Les opérateurs relationnels
Symbole | Exemple | Cas où le résultat renvoit True |
> | opérande1 > opérande2 | opérande1 est strictement supérieur à opérande2 |
>= | opérande1 >= opérande2 | opérande1 est supérieur ou égal à opérande2 |
< | opérande1 < opérande2 | opérande1 est strictement inférieur à opérande2 |
<= | opérande1 <= opérande2 | opérande1 est inférieur ou égal à opérande2 |
== | opérande1 == opérande2 | opérande1 est égal à opérande2 |
!= | opérande1 != opérande2 | opérande1 n'est pas égal à opérande2 |
Exemple
Code Java (Opérateurs relationnels) (48 lignes)
public class OperateursRelationnels { //a few numbers int i = 37; int j = 42; int k = 42; //greater than //greater than or equal to //less than //less than or equal to //equal to //not equal to } }
Ce qui donne en sortie :
Variable values...
i = 37
j = 42
k = 42
Greater than...
i > j = false
j > i = true
k > j = false
Greater than or equal to...
i >= j = false
j >= i = true
k >= j = true
Less than...
i < j = true
j < i = false
k < j = false
Less than or equal to...
i <= j = true
j <= i = false
k <= j = true
Equal to...
i == j = false
k == j = true
Not equal to...
i != j = true
k != j = false
i = 37
j = 42
k = 42
Greater than...
i > j = false
j > i = true
k > j = false
Greater than or equal to...
i >= j = false
j >= i = true
k >= j = true
Less than...
i < j = true
j < i = false
k < j = false
Less than or equal to...
i <= j = true
j <= i = false
k <= j = true
Equal to...
i == j = false
k == j = true
Not equal to...
i != j = true
k != j = false
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 24/04/2005, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/programmation-operateur-relationnel.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.