2011-05-26 18:02:25 -05:00
|
|
|
// -*- rust -*-
|
2012-06-29 18:26:56 -05:00
|
|
|
fn foo(c: ~[int]) {
|
2011-07-27 07:19:39 -05:00
|
|
|
let a: int = 5;
|
2012-06-29 18:26:56 -05:00
|
|
|
let mut b: ~[int] = ~[];
|
2011-05-26 18:02:25 -05:00
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
|
2011-08-13 02:10:18 -05:00
|
|
|
alt none::<int> {
|
2011-12-22 16:42:52 -06:00
|
|
|
some::<int>(_) {
|
2012-04-06 13:01:43 -05:00
|
|
|
for c.each {|i|
|
2011-12-22 19:53:53 -06:00
|
|
|
log(debug, a);
|
2011-12-22 16:42:52 -06:00
|
|
|
let a = 17;
|
2012-06-29 18:26:56 -05:00
|
|
|
b += ~[a];
|
2011-12-22 16:42:52 -06:00
|
|
|
}
|
|
|
|
}
|
2011-08-19 17:16:48 -05:00
|
|
|
_ { }
|
2011-05-26 18:02:25 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-19 20:31:08 -06:00
|
|
|
enum t<T> { none, some(T), }
|
2011-05-26 18:02:25 -05:00
|
|
|
|
2012-06-29 18:26:56 -05:00
|
|
|
fn main() { let x = 10; let x = x + 20; assert (x == 30); foo(~[]); }
|