comp.lang.ada
 help / color / mirror / Atom feed
* Finding the next or the previous value in a enumerated type
@ 2022-11-19 14:05 ldries46
  2022-11-19 14:32 ` Niklas Holsti
  0 siblings, 1 reply; 2+ messages in thread
From: ldries46 @ 2022-11-19 14:05 UTC (permalink / raw)


I do have a enumated type:
type VALUE is (ABC, DEF, GHI, JKL, MNOP);
  Suppose I have a parameter with the value DEF is there a simple way to 
get the next value like you can with integers in the way of V2 := V1 + 1 
for instance OUT := NEXT( ABC).

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Finding the next or the previous value in a enumerated type
  2022-11-19 14:05 Finding the next or the previous value in a enumerated type ldries46
@ 2022-11-19 14:32 ` Niklas Holsti
  0 siblings, 0 replies; 2+ messages in thread
From: Niklas Holsti @ 2022-11-19 14:32 UTC (permalink / raw)


On 2022-11-19 16:05, ldries46 wrote:
> I do have a enumated type:
> type VALUE is (ABC, DEF, GHI, JKL, MNOP);
>   Suppose I have a parameter with the value DEF is there a simple way to 
> get the next value like you can with integers in the way of V2 := V1 + 1 
> for instance OUT := NEXT( ABC).


Next value: VALUE'Succ (V1).
Previous value: VALUE'Pred (V1).

See http://www.ada-auth.org/standards/22rm/html/RM-3-5.html#I1732.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-19 14:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-19 14:05 Finding the next or the previous value in a enumerated type ldries46
2022-11-19 14:32 ` Niklas Holsti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox