Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uakari.primate.wisc.edu!crdgw1!underdog!volpe From: volpe@underdog.crd.ge.com (Christopher R Volpe) Newsgroups: comp.lang.c Subject: Re: The Sins of K&R Message-ID: <12180@crdgw1.crd.ge.com> Date: 26 Sep 90 19:23:36 GMT References: <31604@nigel.ee.udel.edu> Sender: news@crdgw1.crd.ge.com Reply-To: volpe@underdog.crd.ge.com (Christopher R Volpe) Lines: 36 In article <31604@nigel.ee.udel.edu>, shearer@cis.udel.edu (Rob Shearer) writes: |> |>I do this alot: |> |> ch = getch(); |> switch (ch) { |> case 'q': |> case 'Q': |> case 27 : |> case 13 : |> exit_menu = 1; |> break; |> case 'a': |> do_a(); break; |> ...etc |> } How about combining the "let's make break implicit" idea with the "lets add ranges and lists" idea and solve everybody's problems? E.g.: ch = getch(); switch (ch) { case 'q','Q',27,13: exit_menu=1; case 'a': do_a(); ...etc } Now, a break within a case can be used to break out of an enclosing loop, and the "multi-case" capability is still maintained. ================== Chris Volpe G.E. Corporate R&D volpecr@crd.ge.com