Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
This article was originally published on Medium
Follow me:
Comparison Operators
All the comparison operators are the same in Python and Rust.
Meaning | Python | Rust |
---|---|---|
Greater than | > | > |
Less than | < | < |
Equal to | == | == |
Not equal to | != | != |
Greater than or equal to | >= | >= |
Less than or equal to | <= | <= |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
fn main() {
let a = 7;
let b = 4;
let c = a == b;
let d = a != b;
let e = a < b;
let f = a > b;
let g = a <= a;
let h = a >= a;
println!("
a: {}, b: {},
c: {0} == {1} is {},
d: {0} != {1} is {},
e: {0}<{1} is {},
f: {0}>{1} is {},
g: {0}<={0} is {},
h: {0}>={0} is {}",
a, b, c, d, e, f, g, h);
}
Enter to Rename, Shift+Enter to Preview
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content