2011-05-26 16:02:25 -07:00
|
|
|
// -*- rust -*-
|
2011-08-12 15:42:39 -07:00
|
|
|
fn foo(c: [int]) {
|
2011-07-27 14:19:39 +02:00
|
|
|
let a: int = 5;
|
2011-08-12 15:42:39 -07:00
|
|
|
let b: [int] = ~[];
|
2011-05-26 16:02:25 -07:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
|
2011-08-13 00:10:18 -07:00
|
|
|
alt none::<int> {
|
|
|
|
some::<int>(_) { for i: int in c { log a; let a = 17; b += ~[a]; } }
|
2011-08-16 13:24:04 +02:00
|
|
|
_ {}
|
2011-05-26 16:02:25 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-12 06:37:25 -07:00
|
|
|
tag t<T> { none; some(T); }
|
2011-05-26 16:02:25 -07:00
|
|
|
|
2011-08-16 13:24:04 +02:00
|
|
|
fn main() {
|
|
|
|
let x = 10;
|
|
|
|
let x = x + 20;
|
|
|
|
assert x == 30;
|
|
|
|
foo(~[]);
|
|
|
|
}
|