2012-06-29 18:26:56 -05:00
|
|
|
fn foo(x: &[int]) -> int {
|
2012-04-19 18:37:06 -05:00
|
|
|
x[0]
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2012-06-29 18:26:56 -05:00
|
|
|
let p = ~[1,2,3,4,5];
|
2012-04-19 18:37:06 -05:00
|
|
|
let r = foo(p);
|
|
|
|
assert r == 1;
|
|
|
|
|
2012-06-29 18:26:56 -05:00
|
|
|
let p = ~[5,4,3,2,1];
|
2012-04-19 18:37:06 -05:00
|
|
|
let r = foo(p);
|
|
|
|
assert r == 5;
|
|
|
|
}
|