2011-08-22 14:38:48 +02:00
|
|
|
fn main() {
|
2011-09-02 15:34:58 -07:00
|
|
|
let a =
|
2012-01-09 19:15:17 -06:00
|
|
|
alt 10 { x if x < 7 { 1 } x if x < 11 { 2 } 10 { 3 } _ { 4 } };
|
2011-09-02 15:34:58 -07:00
|
|
|
assert (a == 2);
|
2011-08-22 14:38:48 +02:00
|
|
|
|
2011-09-02 15:34:58 -07:00
|
|
|
let b =
|
|
|
|
alt {x: 10, y: 20} {
|
2012-01-09 19:15:17 -06:00
|
|
|
x if x.x < 5 && x.y < 5 { 1 }
|
|
|
|
{x: x, y: y} if x == 10 && y == 20 { 2 }
|
2011-09-02 15:34:58 -07:00
|
|
|
{x: x, y: y} { 3 }
|
|
|
|
};
|
|
|
|
assert (b == 2);
|
2011-08-22 14:38:48 +02:00
|
|
|
}
|