Deutsch English Français Italiano |
<vglj42$3a2c3$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com> Newsgroups: comp.lang.c Subject: Re: else ladders practice Date: Fri, 8 Nov 2024 18:52:01 +0100 Organization: A noiseless patient Spider Lines: 36 Message-ID: <vglj42$3a2c3$1@dont-email.me> References: <3deb64c5b0ee344acd9fbaea1002baf7302c1e8f@i2pn2.org> <vg2llt$38ons$1@dont-email.me> <2491a699388b5891a49ef960e1ad8bb689fdc2ed@i2pn2.org> <b681ee05856e165c26a5c29bf42a8d9d53843d6d@i2pn2.org> <vg2ttn$3a4lk$1@dont-email.me> <vg33gs$3b8n5$1@dont-email.me> <vg358c$3bk7t$1@dont-email.me> <vg37nr$3bo0c$1@dont-email.me> <vg3b98$3cc8q$1@dont-email.me> <vg5351$3pada$1@dont-email.me> <vg62vg$3uv02$1@dont-email.me> <vgd3ro$2pvl4$1@paganini.bofh.team> <vgd6jh$1hmjc$1@dont-email.me> <vgds97$2r682$1@paganini.bofh.team> <vgdvfj$1m6ho$1@dont-email.me> <vge84o$1o57r$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Fri, 08 Nov 2024 18:52:04 +0100 (CET) Injection-Info: dont-email.me; posting-host="d06d34e9af5a8d1ee6a1825f8210d05f"; logging-data="3475843"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX186V7YyXTMSJGqQaIrPaCN+" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:7ywmWa/qMjk3mdA4eSte1TVP4hQ= X-Enigmail-Draft-Status: N1110 In-Reply-To: <vge84o$1o57r$2@dont-email.me> On 06.11.2024 00:01, Bart wrote: > > Well, it started off as 2-way select, meaning constructs like this: > > x = c ? a : b; > x := (c | a | b) > > Where one of two branches is evaluated. I extended the latter to N-way > select: > > x := (n | a, b, c, ... | z) > > Where again one of these elements is evaluated, selected by n (here > having the values of 1, 2, 3, ... compared with true, false above, but > there need to be at least 2 elements inside |...| to distinguish them). I suppose you borrowed that syntax from Algol 68, or is that just coincidence? Algol 68's 'CASE' statement has the abbreviated form you depicted above. (There's also some nesting supported with the '|:' operator, similar to the 'IF' syntax [in Algol 68].) - Personally, though, I use that only very rarely because of the restriction to support only integral numbers as branch selector. > > I applied it also to other statements that can be provide values, such > as if-elsif chains and switch, but there the selection might be > different (eg. a series of tests are done sequentially until a true one). > > I don't know how it got turned into 'multi-way'. > > [...] Janis