2010-07-19 21:06:55 -05:00
|
|
|
|
2011-06-15 13:19:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
// -*- rust -*-
|
2010-07-19 21:06:55 -05:00
|
|
|
type clam = rec(@int x, @int y);
|
2011-06-15 13:19:50 -05:00
|
|
|
|
2011-07-26 07:49:40 -05:00
|
|
|
type fish = rec(@int a);
|
2010-07-19 21:06:55 -05:00
|
|
|
|
|
|
|
fn main() {
|
2011-06-15 13:19:50 -05:00
|
|
|
let clam a = rec(x=@1, y=@2);
|
|
|
|
let clam b = rec(x=@10, y=@20);
|
|
|
|
let int z = a.x + b.y;
|
|
|
|
log z;
|
|
|
|
assert (z == 21);
|
2011-07-26 07:49:40 -05:00
|
|
|
let fish forty = rec(a=@40);
|
|
|
|
let fish two = rec(a=@2);
|
|
|
|
let int answer = forty.a + two.a;
|
2011-06-15 13:19:50 -05:00
|
|
|
log answer;
|
|
|
|
assert (answer == 42);
|
|
|
|
}
|