Adding finally to switch

Henning Hasemann hhasemann at web.de
Tue Apr 1 01:20:04 PDT 2008


Jesse Phillips <jessekphillips at gmail.com> wrote:
> I haven't given it much thought, but I figured I'd let some other
> people look at it too.
> 
> Switch statements are nice, many people hate having to use break; all
> the time, but I don't and am not interest in the debate. What I think
> is missing from a switch statement is a finally section. Most of the
> time I don't have a use for the fall-through feature of switch, but I
> do have a use for doing one or more things that are the same in every
> case.

I don't think I get your point. If you have code that is the same in
*every* case why cant you do:

do_this_before_each_case();
switch(foo) {
 // ...
}
do_this_after_each_case();

Henning

-- 
GPG Public Key:
http://gpg-keyserver.de/pks/lookup?op=get&search=0xDDD6D36D41911851




More information about the Digitalmars-d mailing list