From the course: Rust Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Comparison operations - Rust Tutorial
From the course: Rust Essential Training
Comparison operations
- [Teacher] Another set of operators that can be used to evaluate two values and return a Boolean result are the comparison operators shown here. Operating on integers a and b, declared on lines two and three. The equality comparison operator on line five is represented using two equals symbols. It compares the values on each side of the operator and if they're equivalent the expression evaluates to true. Otherwise, if they're different values it evaluates to false. The non equality comparison operator below that on line six, which is an exclamation mark and an equals sign, operates in a similar but opposite fashion. If variables a and b are equivalent it will evaluate to false, and if they're different it will evaluate to true. The greater than, and greater than or equals comparisons on lines seven and eight work the way you might expect. If the value of integer a is greater than b the expression will evaluate to true,…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Declaring variables5m 46s
-
Integer data types6m 51s
-
Floating-point data types5m 34s
-
Arithmetic operations6m 37s
-
Formatting print statements5m 40s
-
Bitwise operations10m 46s
-
Boolean data type and operations5m 4s
-
Comparison operations3m 5s
-
Char data types2m 36s
-
Challenge: Find the average1m 20s
-
Solution: Find the average3m 20s
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-