* Multi-way Case Statement
@ 1992-12-15 17:35 Mike Ryer
0 siblings, 0 replies; only message in thread
From: Mike Ryer @ 1992-12-15 17:35 UTC (permalink / 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1992-12-15 17:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-12-15 17:35 Multi-way Case Statement Mike Ryer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox