2012-08-08 21:41:50 -05:00
|
|
|
const x : [int]/4 = [1,2,3,4];
|
|
|
|
const p : int = x[2];
|
2012-08-09 18:05:34 -05:00
|
|
|
const y : &[int] = &[1,2,3,4];
|
2012-08-08 21:41:50 -05:00
|
|
|
const q : int = y[2];
|
|
|
|
|
|
|
|
const s : {a: int, b: int} = {a: 10, b: 20};
|
|
|
|
const t : int = s.b;
|
|
|
|
|
2012-08-28 17:54:45 -05:00
|
|
|
const k : {a: int, b: int, c: {d: int, e: int}} = {a: 10, b: 20, c: {d: 30,
|
|
|
|
e: 40}};
|
|
|
|
const m : int = k.c.e;
|
|
|
|
|
2012-08-08 21:41:50 -05:00
|
|
|
fn main() {
|
2012-08-09 18:05:34 -05:00
|
|
|
io::println(fmt!("%?", p));
|
|
|
|
io::println(fmt!("%?", q));
|
2012-08-08 21:41:50 -05:00
|
|
|
io::println(fmt!("%?", t));
|
2012-08-09 18:05:34 -05:00
|
|
|
assert p == 3;
|
|
|
|
assert q == 3;
|
2012-08-08 21:41:50 -05:00
|
|
|
assert t == 20;
|
|
|
|
}
|