Sujet : Re: Command Languages Versus Programming Languages
De : alan (at) *nospam* csail.mit.edu (Alan Bawden)
Groupes : comp.unix.shell comp.unix.programmer comp.lang.miscDate : 06. Apr 2024, 00:35:37
Autres entêtes
Organisation : ITS Preservation Society
Message-ID : <86frvzo01i.fsf@williamsburg.bawden.org>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Lawrence D'Oliveiro <
ldo@nz.invalid> writes:
On Fri, 5 Apr 2024 09:17:37 -0000 (UTC), Muttley wrote:
...
>> a =
>> b ?
>> c ? d : e
>> : f ?
>> g ? h : i
>> : j;
>
> Just use brackets. Saves a lot of pain.
a=(b?(c?d:e):(f?(g?h:i):j));
A normal programmer would write something like:
a = b ? (c ? d : e) :
f ? (g ? h : i) :
j;
I.e., she would allow herself to use spaces and newlines, and just
enough parentheses to make the structure clear.
- Alan