How can you check if an element belongs to one subtype or another?

喜你入骨 提交于 2019-12-05 02:08:53

You want

function is_Weekday ( dayOfTheWeek: in Day_Of_The_Week) return Boolean is
begin
    return dayoFTheWeek in Weekday;
end is_Weekday;

Also, you want ’Val not ’Pos in

selected_day := Day_Of_The_Week'val(selected_day_value);

and you might take a look at the words in the second Put_Line!

James Adam

You don't need a function to check for this. In this case a function only obscures what happens:

if Selected_Day in Weekday then
  do stuff..
else
  do other stuff...
end if;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!