enum SpreadCell {
Int(i16),
Float(f32),
Text(String),
}
fn main () {
let mut v: Vec<i32> = Vec::new();
v.push(123);
let mut a = vec![24, 35, 47];
for i in &mut a {
*i += 50;
}
println!("{:?}", a);
let mut w = vec![1, 3, 4];
let f = w[0];
w.push(5);
println!("{}, {:?}", f, w);
let x = vec![1, 2, 3, 4, 5];
let th = &x[1];
println!("{:?}", th);
match x.get(2) {
Some(th) => println!("thrid is {:?}", th),
None => println!("not found"),
}
let row = vec![
SpreadCell::Int(3),
SpreadCell::Text(String::from("blue")),
SpreadCell::Float(10.12),
];
for cell in &row {
match cell {
SpreadCell::Int(num) => println!("int: {}", num),
SpreadCell::Float(num) => println!("float: {}", num),
SpreadCell::Text(text) => println!("text: {}", text),
}
}
}