Path: csiph.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Kaz Kylheku <643-408-1753@kylheku.com> Newsgroups: comp.lang.awk Subject: Re: nested ternary discovery Date: Sat, 11 Oct 2025 18:46:32 -0000 (UTC) Organization: A noiseless patient Spider Lines: 28 Message-ID: <20251011114253.330@kylheku.com> References: <10c866d$2lhr4$1@dont-email.me> <68e8bf90$0$671$14726298@news.sunsite.dk> <20251010100336.109@kylheku.com> <68ea9764$0$672$14726298@news.sunsite.dk> Injection-Date: Sat, 11 Oct 2025 18:46:33 +0000 (UTC) Injection-Info: dont-email.me; posting-host="682cb4170fd05c1c340665ac222b3d4f"; logging-data="1034304"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/Hkfhh67afAlZmJyqAt8eKqIPqpOhVEw=" User-Agent: slrn/pre1.0.4-9 (Linux) Cancel-Lock: sha1:sb9NPKnHVzXlP06nnPrHjfG3YJo= Xref: csiph.com comp.lang.awk:10027 On 2025-10-11, Mack The Knife wrote: > In article <20251010100336.109@kylheku.com>, > Kaz Kylheku <643-408-1753@kylheku.com> wrote: >>On 2025-10-10, Mack The Knife wrote: >>> { print animal[$1] } >>> >>> Much simpler, and each additional sound/animal pair requires >>> only one additional line of code. >> >>Without function indirection (Gawk extension), or an eval feature >>(doesn't exist in any Awk I know), you cannot dispatch actions, only >>substitute values for keys. > > So what? The OP wasn't looking for a way to dispatch actions. Nested/cascaded ternary will do that: cond1 ? increment_this++ : cond2 ? call_this() : foo[this] = that It's just not shown in the minimal example where it yields string literal values. -- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca