tuppleを使用する。tuppleは異なる型でも動く。
fn main(){ let (x, y) = test(100); println!("x={}, y={}", x, y); } fn test(x: i32)-> (i32, i32) { let y = x * 2; (x, y) }
Running `target/debug/sample`
x=100, y=200
fn main(){ let (x, y, z) = ("hello".to_string(), "world".to_string(), 100); println!("x={}, y={}, z={}", x, y, z); }
Running `target/debug/sample`
x=hello, y=world, z=100