Run ❯
Get your
own
website
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Change Language
Go to Spaces
Ctrl+Alt+P
use std::collections::HashSet; fn main() { let mut john = HashSet::new(); john.insert("chess"); john.insert("football"); let mut jenny = HashSet::new(); jenny.insert("chess"); jenny.insert("tennis"); for hobby in john.intersection(&jenny) { println!("Both like {}", hobby); } println!("Hobbies in total: {}", john.union(&jenny).count()); }
Both like chess
Hobbies in total: 3