aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/enumscope.zc
blob: 6c66ee803b762ccb1cc821b57aef55dfe33b6f55 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
namespace;
include rt;

// enum members are reached through the enum's name as well as plainly
enum color { RED, GREEN = 5, BLUE };
fn main() {
	int c = color.BLUE;
	rt.put_n(color.RED); rt.put_c(' '); rt.put_n(GREEN); rt.put_c(' ');
	rt.put_n(c); rt.put_c(' ');
	switch (c) { case color.BLUE: rt.put_s("blue"); break; default: rt.put_s("other"); }
	return 0;
}