Idiomatically determine all the lowercase and uppercase letters: Difference between revisions
Idiomatically determine all the lowercase and uppercase letters (view source)
Revision as of 05:41, 2 January 2021
, 3 years agono edit summary
(Added XPL0 example.) |
No edit summary |
||
Line 40:
Lower case: abcdefghijklmnopqrstuvwxyz
Upper case: ABCDEFGHIJKLMNOPQRSTUVWXYZ
</pre>
=={{header|Ada}}==
Creates two subtypes of the standard type Character. Subtype Lower is defined to be all the characters from 'a' to 'z'. Subtype Upper is defined to be all characters from 'A' to 'Z'. This program works with any version of Ada.
<lang Ada>
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
subtype Lower is Character range 'a' .. 'z';
subtype Upper is Character range 'A' .. 'Z';
begin
Put ("Lower: ");
for c in Lower'range loop
Put (c);
end loop;
New_Line;
Put ("Upper: ");
for c in Upper'range loop
Put (c);
end loop;
New_Line;
end Main;
</lang>
{{Output}}
<pre>
Lower: abcdefghijklmnopqrstuvwxyz
Upper: ABCDEFGHIJKLMNOPQRSTUVWXYZ
</pre>
|