⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 enum_type_qualification.adb.npp

📁 This contains the following topics and more ADA versus C and Cplus plus Ada_training ADA 2005 for
💻 NPP
字号:
with text_io; use text_io;procedure Enum_type_qualification is--In some situations an expression's or value's type can be ambiguous.   --For example,   type primary is (Red,Green,Blue,yellow,orange);   subtype new_primary is primary range Red ..Blue;   type secondary is (Red,Green,sai,gray,Blue);  -- type rainbow is new integer;   --subtype new_color is rainbow range 1..20;   var_primary,age :primary;   var1_primary :secondary;   i :integer;begin   --var1_primary := var_primary; -- error   age := var_primary;-- no error   --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 primary'(red)..primary'(blue) 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 Enum_type_qualification;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -