I am looking to do a comparison of a string to and enumeration. I have written a sample code of what I am attempting. Since a String and and Enumerated type are different, h
Another possibility:
Get_Line (response, N);
declare
Color : StopLightColor;
begin
Color := StopLightColor'Value(response(1..N));
-- if you get here, the string is a valid color
Put_Line ("The stoplight is " & response(1..N));
exception
when Constraint_Error =>
-- if you get here, the string is not a valid color (also could
-- be raised if N is out of range, which it won't be here)
null;
end;