Article View: comp.lang.c
Article #801Re: Taming The Switch-Statement
From: bartc
Date: Mon, 26 Oct 2026 17:00
Date: Mon, 26 Oct 2026 17:00
30 lines
2431 bytes
2431 bytes
On 26/10/2026 16:45, fir wrote:
> bartc pisze:
>>> without or (or something analogic) as i understand if im not wrong
>>> you cant
>> You seem fixated on that 'or'. Either use 'else', or create 'or' as an
>> alias as I suggested.
>
> imo you should try to understand the example
>
> for(int i = 1; i < 20; i++)
> {
>
> if(x%2==0) printf("\n divides by 2");
> or if(x%3==0) printf("\n divides by 3");
> else printf("\n no divides (by 2 or 3)");
> }
>
> you understand how this would work? i think you do
>
> and how in normal c without this "or" it would look,
> for exampel in your if else model?
Show me exactly what the output should be, when it is written like this:
if(x%2==0) printf("\n%d divides by 2", i);
or if(x%3==0) printf("\n%d divides by 3", i);
else printf("\n%d no divides (by 2 or 3)", i);
You might also want to look at the FizzBuzz program.
Technical Details
Message-ID:
<11bo0ul$pbso$1@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> <11bo02r$otr5$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: bartc <bc@freeuk.com> Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Mon, 26 Oct 2026 17:00:05 +0000 Organization: A noiseless patient Spider Lines: 30 Message-ID: <11bo0ul$pbso$1@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> <11bo02r$otr5$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 26 Oct 2026 17:00:06 +0000 (UTC) Injection-Info: dont-email.me; logging-data="831384"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/r/rZhgntYUcovz+C7HI1s"; posting-host="81ec4569ad44d616cf39a71786ebce1e" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:rLYqqSazB6kSYThf3y7ATN1M6zw= sha256:6Yv6qsTrcKKPY3D9oFgnkZ2y8HbjW5JsSVM3O1vWHpU= sha1:2aTpAzrvnxYv02PEcj3bxd6yz/0= sha256:VK9nT5pQLU6NrKjENgD5vGjd0OMwM9DgTZ6QTGpzY3M= Content-Language: en-GB In-Reply-To: <11bo02r$otr5$1@dont-email.me>