Idiomatically determine all the lowercase and uppercase letters: Difference between revisions

No edit summary
Line 622:
{{out}}
<pre>abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ</pre>
 
=={{header|Nim}}==
Nim has a <code>char</code> type whose values are contained in a single bit. The values from 0 to 127 are the ASCII characters. Strings are composed of char values but they are considered to be encoded in UTF-8. So accessing an individual character of a string may have no meaning when not working in ASCII.
 
The following program displays the lowercase and uppercase letters. Note that Nim allows to work with full Unicode, either by using strings encoded in UTF-8 (but with limited possibilities) or by using the runes of the module “unicode”.
 
<lang Nim>import sequtils, strutils
 
echo "Lowercase characters:"
echo toSeq('a'..'z').join()
echo ""
echo "Uppercase characters:"
echo toSeq('A'..'Z').join()</lang>
 
{{out}}
<pre>Lowercase characters:
abcdefghijklmnopqrstuvwxyz
 
Uppercase characters:
ABCDEFGHIJKLMNOPQRSTUVWXYZ</pre>
 
Anonymous user