Article View: comp.lang.c
Article #939Re: Taming The Switch-Statement
From: chine.bleu
Date: Wed, 28 Oct 2026 12:56
Date: Wed, 28 Oct 2026 12:56
23 lines
2156 bytes
2156 bytes
bartc wrote:
>> maybe try with like
>>
>> case x%2==0 //2 4 6 8 10 12
>> case x%3==0 //3 6 9 12
>
> No, cases '6' and '12' are also true for x%2==0. Unless you want these
> to be non-exclusive?
>
>> default // 1 5 7 11 13
You can do guards with C syntax.
if (x%2==0) {...; goto out;}
if (x%3==0) {...; goto out;}
...
{default action....} out:;
--
Siri Seal of Disavowal #777-000. Disavowed. Denied. @
NO KINGS For I desire mercy not sacrifice. /|\
The Church of the Holey Apple .signature 5.5 / \
of Discordian Mysteries. This post insults Islam. Mohamed
Technical Details
Message-ID:
<11bsreh$2dr1j$2@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<119qf6l$2rmg3$1@dont-email.me> <11ba02r$3pl5h$1@dont-email.me> <11bnfpm$i84l$1@dont-email.me> <11bng23$iblc$1@dont-email.me> <11bngj1$ifj5$1@dont-email.me> <11bnnbg$l7i1$1@dont-email.me> <11bntk0$nsbo$1@dont-email.me> <11bnvbq$olbj$1@dont-email.me> <11bnvl2$opb9$1@dont-email.me> <11bnvug$otdl$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: "chine.bleu" <chine.bleu@yahoo.com> Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Wed, 28 Oct 2026 05:56:49 -0700 Organization: semi-chaotic Lines: 23 Message-ID: <11bsreh$2dr1j$2@dont-email.me> References: <119qf6l$2rmg3$1@dont-email.me> <11ba02r$3pl5h$1@dont-email.me> <11bnfpm$i84l$1@dont-email.me> <11bng23$iblc$1@dont-email.me> <11bngj1$ifj5$1@dont-email.me> <11bnnbg$l7i1$1@dont-email.me> <11bntk0$nsbo$1@dont-email.me> <11bnvbq$olbj$1@dont-email.me> <11bnvl2$opb9$1@dont-email.me> <11bnvug$otdl$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 28 Oct 2026 12:56:49 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2550835"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1979JRX9UuNXw42G+Fr7IPD++ZuFI+cTaU="; posting-host="0866d56496ccff7456470701a5d36b07" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:32.0) Gecko/20100101 Firefox/32.0 SeaMonkey/2.29.1 Cancel-Lock: sha1:v6N9hsr8Dan86e+5KLiuS9KP3PM= sha256:iYMVJ7/dDbyS5UNMQQID0fZxPbsmlWvae2gkDrCFvWM= sha1:BcNRbQZ4xD0MPrjVr6rZ6Wcwi2M= sha256:BEONpeyHqn4WC6kZRX2CQYPBaFuT1EGQI6DJqPIqotg= In-Reply-To: <11bnvug$otdl$1@dont-email.me>