GitHub

Miscellaneous

Tips and Tricks

Random tips and tricks

Errors and Solutions

[Stuck] Blocking waiting for file lock on package cache Delete .package-cache file

rm ~/.cargo/.package-cache

Order and Priority

See how adding parantheses, changed the result. It is not about the order here, always && will happen before ||

Program

fn main() {
let (a, b, c) = (true, true, false);
let mut d;
println!("a is {}, b is {}, c is {}", a, b, c);
d = a || b && c;
println!("a || b && c, \t => {}", d);
d = (a || b) && c;
println!("(a || b) && c, \t => {}", d);
d = c && a || b;
println!("c && a || b, \t => {}", d);
}

Result

a is true, b is true, c is false
a || b && c, => true
(a || b) && c, => false
c && a || b, => true
Previous
Module System