I want to try and write a match with variables as the condition ie
fn sub(x: uint ,y: uint) -> Vec<char> {
let mut out: Vec<char> = Vec::new();
out.push('-');
let mut xw: bool = true;
let mut yw: bool = true;
let mut count: uint = 0;
while xw || yw {
match count {
x => {out.push('2'); xw = false;}
y => {out.push('1'); yw = false;}
_ => {out.push('_');}
}
count+=1;
}
etc
I get "error: unreachable pattern "...
Is there a way to do this nicely or am I back to if
statements?
thanks in advance