Generate lower case ASCII alphabet: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: added tagstart() example) |
|||
Line 2,196: | Line 2,196: | ||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
<!--<syntaxhighlight lang="phix">(phixonline)--> |
<!--<syntaxhighlight lang="phix">(phixonline)--> |
||
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span> |
|||
<span style="color: #004080;">string</span> <span style="color: #000000;">az</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">""</span> |
<span style="color: #004080;">string</span> <span style="color: #000000;">az</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">""</span> |
||
<span style="color: #008080;">for</span> <span style="color: #000000;">ch</span><span style="color: #0000FF;">=</span><span style="color: #008000;">'a'</span> <span style="color: #008080;">to</span> <span style="color: #008000;">'z'</span> <span style="color: #008080;">do</span> |
|||
<span style="color: #000000;">az</span> <span style="color: #0000FF;">&=</span> <span style="color: #000000;">ch</span> |
|||
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span> |
|||
<span style="color: #0000FF;">?</span><span style="color: #000000;">az</span> |
<span style="color: #0000FF;">?</span><span style="color: #000000;">az</span> |
||
<span style="color: #0000FF;">?</span><span style="color: #7060A8;">tagset</span><span style="color: #0000FF;">(</span><span style="color: #008000;">'z'</span><span style="color: #0000FF;">,</span><span style="color: #008000;">'a'</span><span style="color: #0000FF;">)</span> |
<span style="color: #0000FF;">?</span><span style="color: #7060A8;">tagset</span><span style="color: #0000FF;">(</span><span style="color: #008000;">'z'</span><span style="color: #0000FF;">,</span><span style="color: #008000;">'a'</span><span style="color: #0000FF;">)</span> |
||
<span style="color: #0000FF;">?</span><span style="color: #7060A8;">tagstart</span><span style="color: #0000FF;">(</span><span style="color: #008000;">'a'</span><span style="color: #0000FF;">,</span><span style="color: #000000;">26</span><span style="color: #0000FF;">)</span> |
|||
<!--</syntaxhighlight>--> |
<!--</syntaxhighlight>--> |
||
Using tagset() is obviously easier, but you have to remember its parameters are (finish,start=1,step=1), that way round so that start ''can'' be omitted and default to 1 (ditto step).<br> |
Using tagset() is obviously easier, but you have to remember its parameters are (finish,start=1,step=1), that way round so that start ''can'' be omitted and default to 1 (ditto step). tagstart() wants a length, though you could use 'z'-'a'+1 in place of the 26.<br> |
||
In Phix there is really not much difference between 1..26 and 'a'..'z', and none ''at all'' between 'a'..'z' and 97..122. |
In Phix there is really not much difference between 1..26 and 'a'..'z', and none ''at all'' between 'a'..'z' and 97..122. |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
"abcdefghijklmnopqrstuvwxyz" |
|||
"abcdefghijklmnopqrstuvwxyz" |
"abcdefghijklmnopqrstuvwxyz" |
||
"abcdefghijklmnopqrstuvwxyz" |
"abcdefghijklmnopqrstuvwxyz" |