Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!hao!gatech!purdue!i.cc.purdue.edu!j.cc.purdue.edu!ksb From: ksb@j.cc.purdue.edu (Kevin Braunsdorf) Newsgroups: comp.lang.c Subject: Re: The D Switch Loop?? Message-ID: <6548@j.cc.purdue.edu> Date: 1 Mar 88 16:39:15 GMT References: many Reply-To: ksb@s.cc.purdue.edu.UUCP (Kevin Braunsdorf) Distribution: na Organization: Purdue UNIX Group Lines: 24 Keywords: switch loop Summary: (for D) make switch a loop For a replacement for C why can't we make a switch statement loop? We can make switch less of a hack in the lanuage. Make the switch loop be default so we trap switches without a default. switch (func(param)) { case (0): param = dosomething(); continue; case (1): param = tryagain(); continue; case (2): param = stillanother(); continue; case (3): default: break; } This way we have a DFA. Maybe we can even dink the ':' after the case. Kevin S Braunsdorf ksb@s.cc.purdue.edu