🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #788

Re: Taming The Switch-Statement

#788
From: bartc
Date: Mon, 26 Oct 2026 14:16
59 lines
2870 bytes
On 26/10/2026 12:20, fir wrote:
> bartc pisze:
>> On 26/10/2026 12:07, fir wrote:
>>> fir pisze:
>>>> if {} or if {} or if {} else {}
>>>
>>>
>>> this form in fact is not bad, it simply showst two things
>>>
>>> 1) you may use or outside the if clause (if this () can be named clause)
>>>
>>> 2) else in fact work on logical group but ias sole if is alos a case 
>>> of logical group so else work on it sole in special case
>>>
>>> otherwiste thse keywords here if or and else are quite 'legit'
>>>
>>>
>>>
>>> if () {}
>>> or if () {}
>>> or if() {}
>>> else {}
>>>
>>>
>>> seems quite legit and it seem to ba a switch
>> Excellent. A great thing about this is, this can also be legal C, that 
>> works now, if you just precede with this:
>>
>>    #define or else
>>
> this wouldnt work imo as far as im aware becouse this last else dont 
> work on "group'

This works fine:

     #define or else

     for (int i=0; i<=5; ++i)
         if    (i==1) {puts("One");}
         or if (i==2) {puts("Two");}
         or if (i==3) {puts("Three");}
         else         {puts("Other");}

Output is:

   Other
   One
   Two
   Three
   Other
   Other

The point is you eventually came up with syntax that is actually just C 
but using 'or' in place of 'else'.

> the last else is what i name "otherwise" (its else in all other case"
You seem to have named it 'else' in your example. In any case it would 
just be a slightly different choice of keyword; it buys you very little.
Technical Details
Message-ID: <11bnnbg$l7i1$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-mail
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>

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 14:16:16 +0000
Organization: A noiseless patient Spider
Lines: 59
Message-ID: <11bnnbg$l7i1$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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 26 Oct 2026 14:16:17 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="695873"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/rTEI79mYShm6r/opQYSLb"; posting-host="81ec4569ad44d616cf39a71786ebce1e"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:k8Q93YKzLu6m73O4Qd3yP8NR3to= sha256:fZEecdFP4zZIaVxIGT1ScDqt4/5K5gtkQxTDcETSWMw=
	sha1:d6jDiTyvs7jbAQ8laLgnKj9jlUY= sha256:YfUHq69h2PBx86tYKHlnLvtFZA1UNPkbigcykC2z1Pg=
In-Reply-To: <11bngj1$ifj5$1@dont-email.me>
Content-Language: en-GB