On Sun, 2009-09-27 at 15:45 +0200, Nicolas wrote: > Hi, > > I have a problem convert function from vala to genie, this is the code: > > Vala code: > > switch (eb.button) { > case 1: > blah blah blah > case 2: > blah blah blah > case 3: > blah blah blah > } > > > My genie code: > > case eb.button > when 1 > blah blah blah > when 2 > blah blah blah > when 3 > blah blah blah > > The problem is, when i compile, i have this message: > > treeview.gs:132.9-143.13: warning: unreachable code detected > treeview.gs:132.9-146.13: warning: unreachable code detected > > And my real function (not blah blah blah) does not work, what's wrong ? > Does genie support the "switch" like vala ? >
it works the same as vala except you dont need a break statement EG in vala : switch (eb.button) { case 1: do_something (); break; case 2: do_something (); break; case 3: do_something (); break; } is same as Genie case eb.button when 1 do_something (); when 2 do_something (); when 3 do_something (); if you want to combine options just use comma case eb.button when 1,2,3 do_something (); this is same as vala switch (eb.button) { case 1: case 2: case 3: do_something (); break; } please use latest vala master and send me code file if problem persists jamie _______________________________________________ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list