📄 type_qualification.adb
字号:
with Text_IO; use Text_IO;
procedure type_qualification is
--In some situations an expression's or value's type can be ambiguous.
--For example,
type color is new Integer;
subtype primary is color range 1 .. 20;
type rainbow is new Integer;
subtype new_color is rainbow range 1 .. 20;
begin
--for i in red..blue loop -- this is ambiguous
-- Here we need to specify precisely what type is required. This is done
--with type qualification.
for i in rainbow'(1) .. rainbow'(5) loop
-- for i in rainbow'(red)..blue loop -- only one qualification needed
--for i in primary'(red)..blue loop
--Type qualification does not change a value's type. It merely informs
--the compiler of what type the programmer thinks it should be.
Put_Line ("hai");
end loop;
--end loop;
-- end loop;
end type_qualification;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -