error fix

- fixed the `Option` condition 
- fixed the `swap` value
This commit is contained in:
Suman Biswas 2023-01-09 23:44:08 +05:30 committed by GitHub
parent c5898ac6b7
commit 5213705265
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@
#[allow(unused_variables, unused_assignments)]
fn main() {
let my_option: Option<()> = None;
if my_option.is_none() {
if !my_option.is_none() {
my_option.unwrap();
}
@ -22,7 +22,8 @@ fn main() {
let mut value_a = 45;
let mut value_b = 66;
// Let's swap these two!
let temp_a = value_a;
value_a = value_b;
value_b = value_a;
value_b = temp_a;
println!("value a: {}; value b: {}", value_a, value_b);
}