From: agate!spool.mu.edu!hri.com!noc.near.net!inmet!ryer@ucbvax.Berkeley.EDU ( Mike Ryer)
Subject: Multi-way Case Statement
Date: 15 Dec 92 17:35:05 GMT [thread overview]
Message-ID: <1992Dec15.173505.11693@inmet.camb.inmet.com> (raw)
Here's another way to get the affect of multi-way case:
type Three_Cases is (F_F_F, F_F_T, F_T_F, F_T_T,
T_F_F, T_F_T, T_T_F, T_T_T);
Truth_Table: constant array (Boolean, Boolean, Boolean) of Three_Cases :=
(((F_F_F, F_F_T), (F_T_F, F_T_T)),
((T_F_F, T_F_T), (T_T_F, T_T_T)));
begin
. . .
case Truth_Table(a>b, c/=d, e<f) is
when F_T_F | F_T_T => ...
when T_T_F | T_F_F => ...
when T_T_T => ...
when others => ...
end case;
Once you set up the two top declarations, you can code as many 3-way case
statements as you like, without repeating them. I suspect that the ultimate
generated code is the same as what you would get if it were a built-in
language feature.
Mike Ryer
Intermetrics
reply other threads:[~1992-12-15 17:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox