Generate lower case ASCII alphabet: Difference between revisions
m
→{{header|OCaml}}: alternative
Puppydrum64 (talk | contribs) |
m (→{{header|OCaml}}: alternative) |
||
(47 intermediate revisions by 33 users not shown) | |||
Line 7:
During code review it's not immediate obvious to spot the bug in a Tcl line like this contained in a page of code:
<
Line 15:
=={{header|0815}}==
This creates the list in the queue
<
=={{header|11l}}==
<syntaxhighlight lang
{{out}}
<pre>
Line 27:
In EBCDIC coding there are more than 24 characters between a and z.
So we have to get rid of characters between i and j and also between r and s.
<
LOWER CSECT
USING LOWER,R15 set base register
Line 54:
PG DS CL26 buffer
YREGS
END LOWER</
{{out}}
<pre>
Line 62:
=={{header|6502 Assembly}}==
Stores the lower-case ASCII alphabet as a null-terminated string beginning at address 2000 hex. Register contents are preserved.
<
TXA ; shall be using onto the stack
PHA
Line 78:
TAX ; the stack
PLA
RTS ; return</
=={{header|68000 Assembly}}==
{{trans|6502 Assembly}}
Stores the lower-case ASCII alphabet as a null-terminated string beginning at address 100000 hex. Register contents are preserved.
Line 91 ⟶ 88:
Called as a subroutine (i.e. "JSR Ascii_Low" if far away or "BSR Ascii_Low" if nearby)
<
Ascii_Low:
MOVEM.L D0/A0,-(SP) ;store D0 and A0 on stack
Line 108 ⟶ 105:
rts
</syntaxhighlight>
=={{header|8080 Assembly}}==
Line 115 ⟶ 112:
in the form of an <code>$</code>-terminated string that CP/M syscalls can use.
<
jmp test
Line 144 ⟶ 141:
buf: ds 27 ; buffer to keep the alphabet in
</syntaxhighlight>
=={{header|8086 Assembly}}==
<
cpu 8086
org 100h
Line 172 ⟶ 169:
ret
section .bss
buf: resb 27 ; Buffer to store the alphabet in</
=={{header|8th}}==
We take an empty string, and use the "loop" word to create a new character using "'a n:+". The loop passes the current index to the code being iterated, so it starts with 0 and up to 25, adding to the "'a" - which is the numeric value of lowercase "a", and the resultant number is then appended to the string. That converts the number to the appropriate character and appends it:
<
"" ( 'a n:+ s:+ ) 0 25 loop
. cr
</syntaxhighlight>
{{out}}
<pre>
Line 187 ⟶ 184:
=={{header|ABAP}}==
=== Example with simple write statement ===
<
WRITE: / to_lower( sy-abcde ).</
=== Example with / without space using CL_DEMO_OUTPUT class ===
<
cl_demo_output=>new(
Line 201 ⟶ 198:
ELSE |{ out } { COND string( WHEN char <> strlen( sy-abcde ) THEN sy-abcde+char(1) ) }| ) )
)->write( |Or use the system field: { sy-abcde }|
)->display( ).</
=={{header|Action!}}==
<syntaxhighlight lang="action!">byte X
Proc Main()
For X=97 To 122
Do
Put(x)
Od
Return</syntaxhighlight>
{{Out}}
<pre>abcdefghijklmnopqrstuvwxyz</pre>
=={{header|Ada}}==
Line 207 ⟶ 218:
We start with a strong type definition: A character range that can only hold lower-case letters:
<
Now we define an array type and initialize the Array A of that type with the 26 letters:
<
A : Arr_Type (1 .. 26) := "abcdefghijklmnopqrstuvwxyz";</
Strong typing would catch two errors: (1) any upper-case letters or other symbols in the string assigned to A, and (2) too many or too few letters assigned to A. However, a letter might still appear twice (or more) in A, at the cost of one or more other letters. Array B is safe even against such errors:
<
begin
B(B'First) := 'a';
for I in B'First .. B'Last-1 loop
B(I+1) := Lower_Case'Succ(B(I));
end loop; -- now all the B(I) are different</
=={{header|ALGOL 68}}==
{{works with|ALGOL 68G|Any - tested with release 2.6.win32}}
<
# so we can declare an array of 26 characters and assign a string #
# containing the lower-case letters to it #
[ 26 ]CHAR lc := "abcdefghijklmnopqrstuvwxyz"
</syntaxhighlight>
Alternative version
<
# they are consecutive in the character set, as they are in ASCII #
Line 239 ⟶ 250:
DO
lc[ i ] := REPR ( ABS "a" + ( i - 1 ) )
OD</
=={{header|ALGOL W}}==
<
string(26) lc;
for c := 0 until 25 do lc( c // 1 ) := code( decode( "a" ) + c );</
=={{header|APL}}==
{{works with|Dyalog APL}}
<
=={{header|AppleScript}}==
<
on run
unlines(map(concat, ¬
Line 343 ⟶ 354:
set my text item delimiters to dlm
s
end unlines</
{{Out}}
<pre>abcdefghijklmnopqrstuvwxyz
Line 352 ⟶ 363:
A minor variation would be to perform a mass conversion and character extraction at the end instead of twenty-six individual <tt>character id i</tt> conversions:
<
repeat with i from id of "a" to id of "z"
set end of l to i
end repeat
return characters of string id l</
{{Out}}
<
=={{header|Applesoft BASIC}}==
<
On the older model Apple II and Apple II plus, it is difficult to enter lower case characters. The following code generates the same string:
<
=={{header|
{{trans|Z80 Assembly}}
Uses VASM syntax. <code>PrintString</code> routine courtesy of [http://www.chibiakumas.com Chibiakumas]
Hardware: Game Boy Advance (ARM7TDMI)
This code generates the lower case ASCII set, stores it in RAM as a string literal, and prints that string to the screen.
<syntaxhighlight lang="arm assembly">ProgramStart:
mov sp,#0x03000000 ;Init Stack Pointer
mov r4,#0x04000000 ;DISPCNT -LCD Control
mov r2,#0x403 ;4= Layer 2 on / 3= ScreenMode 3
str r2,[r4] ;hardware specific routine, activates Game Boy's bitmap mode
mov r0,#0x61 ;ASCII "a"
mov r2,#ramarea
mov r1,#26
rep_inc_stosb: ;repeatedly store a byte into memory, incrementing the destination and the value stored
; each time.
strB r0,[r2]
add r0,r0,#1
add r2,r2,#1
subs r1,r1,#1
bne rep_inc_stosb
mov r0,#255
strB r0,[r2] ;store a 255 terminator into r1
mov r1,#ramarea
bl PrintString ;Prints a 255-terminated string using a pre-defined bitmap font. Code omitted for brevity
forever:
b forever ;halt the cpu</syntaxhighlight>
{{out}}
[https://ibb.co/4SbsgzP Picture of output]
=={{header|Arturo}}==
<syntaxhighlight lang="rebol">print to [:char] 97..122</syntaxhighlight>
{{out}}
<pre>a b c d e f g h i j k l m n o p q r s t u v w x y z</pre>
=={{header|ATS}}==
<syntaxhighlight lang="ats">
(* ****** ****** *)
//
Line 402 ⟶ 449:
//
} (* end of [main0] *)
</syntaxhighlight>
=={{header|AutoHotkey}}==
{{works with|AutoHotkey 1.1}}
<
Loop, 26
a.Insert(Chr(A_Index + 96))</
=={{header|AutoIt}}==
<syntaxhighlight lang="autoit">
Func _a2z()
Local $a2z = ""
Line 419 ⟶ 466:
Return $a2z
EndFunc
</syntaxhighlight>
=={{header|AWK}}==
Line 428 ⟶ 475:
Note this is dependent on the locale-setting,
and options, e.g. --traditional and --posix
<syntaxhighlight lang="awk">
# syntax: GAWK -f GENERATE_LOWER_CASE_ASCII_ALPHABET.AWK
BEGIN {
Line 440 ⟶ 487:
exit(0)
}
</syntaxhighlight>
{{Output}}
<pre>
Line 449 ⟶ 496:
=={{header|BASIC}}==
==={{header|BBC BASIC}}===
<
FOR i%=0TO25
lower&(i%)=ASC"a"+i%
NEXT
END</
==={{header|BASIC256}}===
<
# generate lowercase ascii alphabet
# basic256 1.1.4.0
Line 466 ⟶ 513:
print a$[i] + " ";
next i
</syntaxhighlight>
{{out}}
<pre>
Line 473 ⟶ 520:
==={{header|Commodore BASIC}}===
<
20 A$ = A$+CHR$(I)
30 NEXT
40 PRINT CHR$(14) : REM 'SWITCH CHARACTER SET TO LOWER/UPPER CASES
50 PRINT A$</
==={{header|FreeBASIC}}===
<
' Create a string buffer to store the alphabet plus a final null byte
Line 494 ⟶ 541:
Print "Press any key to quit"
Sleep
</syntaxhighlight>
{{out}}
Line 502 ⟶ 549:
==={{header|IS-BASIC}}===
<
110 LET ALPHA$=""
120 FOR I=ORD("a") TO ORD("z")
130 LET ALPHA$=ALPHA$&CHR$(I)
140 NEXT
150 PRINT ALPHA$</
==={{header|PureBasic}}===
<
For i = 0 To ArraySize(lower_case())
lower_case(i) = i + 'a'
Next</
==={{header|QBasic}}===
{{works with|QBasic|1.1}}
{{works with|QuickBasic|4.5}}
{{works with|True BASIC}}
<syntaxhighlight lang="qbasic">DIM a$(27)
FOR i = 1 to 26
LET a$(i) = CHR$(i + 96)
PRINT a$(i);
NEXT i
END</syntaxhighlight>
==={{header|True BASIC}}===
{{works with|QBasic|1.1}}
{{works with|QuickBasic|4.5}}
<syntaxhighlight lang="qbasic">DIM a$(27)
FOR i = 1 to 26
LET a$(i) = CHR$(i + 96)
PRINT a$(i);
NEXT i
END</syntaxhighlight>
==={{header|XBasic}}===
{{works with|Windows XBasic}}
<syntaxhighlight lang="qbasic">PROGRAM "progname"
VERSION "0.0000"
DECLARE FUNCTION Entry ()
FUNCTION Entry ()
DIM a$[27]
FOR i = 1 TO 26
a$[i] = CHR$(i + 96)
PRINT a$[i];
NEXT i
END FUNCTION
END PROGRAM</syntaxhighlight>
==={{header|Yabasic}}===
{{works with|QBasic|1.1}}
{{works with|QuickBasic|4.5}}
{{works with|Run BASIC}}
<syntaxhighlight lang="yabasic">for i = asc("a") to asc("z")
print chr$(i);
next i</syntaxhighlight>
==={{header|Run BASIC}}===
<
print chr$(i);
next i</
<pre>abcdefghijklmnopqrstuvwxyz</pre>
==={{header|uBasic/4tH}}===
<syntaxhighlight lang="text">For x= ORD("a") To ORD("z") : @(x - ORD("a")) = x : Next</
==={{header|ZX Spectrum Basic}}===
{{trans|BBC_BASIC}}
<
20 FOR i=1 TO 26
30 LET l$(i)=CHR$ (init+i)
40 NEXT i
50 PRINT l$</
==={{header|BaCon}}===
Using the inline loop construct.
<
{{out}}
<pre>abcdefghijklmnopqrstuvwxyz</pre>
=={{header|Batch File}}==
<
@echo off
setlocal enabledelayedexpansion
Line 551 ⟶ 647:
echo %alphabet%
pause>nul
</syntaxhighlight>
{{out}}
<pre>
Line 559 ⟶ 655:
=={{header|Befunge}}==
The left hand side pushes the sequence 'a' to 'z' onto the stack in reverse order with a null terminator (a fairly typical Befunge pattern). The right hand side is just printing it out again to test.
<
^:- 1:<</
=={{header|BQN}}==
<syntaxhighlight lang="bqn">'a'+↕26</syntaxhighlight>
=={{header|Bracmat}}==
<
& whl
' ( chr$(asc$!c+1):~>z:?c
& !seq !c:?seq
)
& !seq</
=={{header|Brainf***}}==
<
>>>>>>>>>>>>>
>>>>>>>>>>>>>
Line 597 ⟶ 696:
Print each cell
>[.>]
++++++++++. \n</
Uncommented:
<
+[>]>]<<[+++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++<]>[.>]++++++++++.</
A smaller and faster solution:
<
++++++++++++++++++++++++++ ++++++
++++++++++++++++++++++++++ ++++++
++++++++++++++++++++++++++ ++++++
< [ - > + . < ]</
{{out}}
Line 616 ⟶ 715:
=={{header|Burlesque}}==
<
abcdefghijklmnopqrstuvwxyz</
=={{header|C}}==
<
#define N 26
Line 633 ⟶ 732:
return EXIT_SUCCESS;
}
</syntaxhighlight>
=={{header|C sharp}}==
Simple Linq 1 liner solution
<
using System.Linq;
Line 646 ⟶ 745:
Console.WriteLine(String.Concat(Enumerable.Range('a', 26).Select(c => (char)c)));
}
}</
Old style Property and enumerable based solution
<
{
using System;
Line 672 ⟶ 771:
}
}
}</
=={{header|C++}}==
C++ can do the task in the identical way as C, or else, it can use a STL function.
{{works with|C++11}}
<
#include <numeric>
Line 684 ⟶ 783:
std::iota(lower.begin(), lower.end(), 'a');
}</
=={{header|Clojure}}==
<
{{out}}
<pre>
Line 693 ⟶ 792:
</pre>
=={{header|CLU}}==
<syntaxhighlight lang="clu">alph = proc () returns (string)
a: int := char$c2i('a')
letters: array[char] := array[char]$predict(1,26)
for i: int in int$from_to(0, 25) do
array[char]$addh(letters, char$i2c(a + i))
end
return(string$ac2s(letters))
end alph
% test
start_up = proc ()
stream$putl(stream$primary_output(), alph())
end start_up</syntaxhighlight>
{{out}}
<pre>abcdefghijklmnopqrstuvwxyz</pre>
=={{header|COBOL}}==
Strings in COBOL are mutable and can be subscripted: each time we go round the loop, we assign to a one-character-long section of the string we are building.
<
program-id. lower-case-alphabet-program.
data division.
Line 711 ⟶ 826:
add-next-letter-paragraph.
add 97 to loop-counter giving character-code.
move function char(character-code) to lower-case-alphabet(loop-counter:1).</
{{out}}
<pre>abcdefghijklmnopqrstuvwxyz</pre>
=={{header|CoffeeScript}}==
<
(String.fromCharCode(x) for x in [97..122])
</syntaxhighlight>
=={{header|Comal}}==
<syntaxhighlight lang="comal">dim alphabet$ of 26
for i := 1 to 26
alphabet$(i) := chr$(ord("a") - 1 + i)
endfor i
print alphabet$</syntaxhighlight>
{{Out}}
<pre>abcdefghijklmnopqrstuvwxyz</pre>
=={{header|Common Lisp}}==
<nowiki>;; as a list</nowiki>
<
(loop with a = (char-code #\a)
for i below 26
collect (code-char (+ a i))))</
<nowiki>;; as a string</nowiki>
<
(map 'string #'code-char (loop
for c from (char-code #\a) to (char-code #\z)
collect c))
"The 26 lower case letters in alphabetical order.")</
<nowiki>;; verify</nowiki>
<
(assert (every #'char< *lowercase-alphabet-string* (subseq *lowercase-alphabet-string* 1)))
(assert (apply #'char< *lower*))
(assert (string= *lowercase-alphabet-string* (coerce *lower* 'string)))</
=={{header|Cowgol}}==
<
# Generate the alphabet and store it at the given location
Line 758 ⟶ 882:
# Use the subroutine to print the alphabet
var buf: uint8[27]; # make room for the alphabet
print(alph(&buf as [uint8]));</
{{out}}
Line 766 ⟶ 890:
=={{header|D}}==
The lower case ASCII letters of the Phobos standard library:
<
void main() {}</
The generation of the ASCII alphabet array:
<
char['z' - 'a' + 1] arr;
foreach (immutable i, ref c; arr)
c = 'a' + i;
}</
An alternative version:
<
import std.range, std.algorithm, std.array;
char[26] arr = 26.iota.map!(i => cast(char)('a' + i)).array;
}</
Another version:
<
char[] arr;
Line 792 ⟶ 916:
assert(arr == "abcdefghijklmnopqrstuvwxyz");
}</
=={{header|
Construct the numerical representation of the desired output and print it.
<
Output:
<pre>
Line 803 ⟶ 927:
=={{header|Delphi}}==
<
var
Line 813 ⟶ 937:
write(ch);
end;
end.</
=={{header|Draco}}==
<syntaxhighlight lang="draco">/* Generate the lowercase alphabet and store it in a buffer */
proc alph(*char buf) *char:
channel output text ch;
char letter;
open(ch, buf);
for letter from 'a' upto 'z' do
write(ch; letter)
od;
close(ch);
buf
corp
/* Use the function to print the alphabet */
proc main() void:
[27] char buf; /* one byte extra for the string terminator */
writeln(alph(&buf[0]))
corp</syntaxhighlight>
{{out}}
<pre>abcdefghijklmnopqrstuvwxyz</pre>
=={{header|DUP}}==
Line 819 ⟶ 964:
In DUP, strings between double quotes are stored in a numerically addressed array. The integer before the first <code>"</code> which gets pushed on the data stack, defines the cell address in which the ASCII value of first character of the string will be stored. All following characters will be stored like an array as values in the following cells. At the end, DUP pushes the length of the string on the data stack.
<
26[$][^^-;,1-]# {Loop from 26-26 to 26-0, print the respective cell contents to STDOUT}</
Output:
Line 830 ⟶ 975:
Generates a lazy sequence and prints it to a standard output:
<
=={{header|EasyLang}}==
<syntaxhighlight lang="easylang">
# Generated on an array
for i = 97 to 122
alphabet$[] &= strchar i
.
print alphabet$[]
# Generated on a string
for i = 97 to 122
alphabet$ &= strchar i
.
print alphabet$
</syntaxhighlight>
=={{header|EchoLisp}}==
<
;; 1)
(define \a (first (string->unicode "a")))
Line 848 ⟶ 1,007:
(for/string ((letter ["a" .. "z"])) letter)
→ abcdefghijklmnopqrstuvwxyz
</syntaxhighlight>
=={{header|Elena}}==
ELENA
<
import system'collections;
Line 861 ⟶ 1,020:
char current;
get Value() = current;
bool next()
Line 893 ⟶ 1,052:
{
console.printLine(Alphabet)
}</
{{out}}
<pre>
Line 900 ⟶ 1,059:
=={{header|Elixir}}==
<
'abcdefghijklmnopqrstuvwxyz'
iex(2)> Enum.to_list(?a .. ?z) |> List.to_string
"abcdefghijklmnopqrstuvwxyz"</
=={{header|Erlang}}==
<
{{Output}}
Line 919 ⟶ 1,078:
{{Works with|Office 365 betas 2021}}
<
=LAMBDA(az,
ENUMFROMTOCHAR(
Line 926 ⟶ 1,085:
MID(az, 2, 1)
)
)</
and also assuming the following generic binding in the Name Manager for the WorkBook:
<
=LAMBDA(a,
LAMBDA(z,
Line 951 ⟶ 1,110:
)
)
)</
{{Out}}
Line 1,202 ⟶ 1,361:
=={{header|F_Sharp|F#}}==
<
printfn "%A" lower</
=={{header|Factor}}==
Strings are represented as fixed-size mutable sequences of Unicode code points.
<
ALPHABET print
Line 1,215 ⟶ 1,374:
: russian-alphabet-without-io ( -- str ) 0x0430 0x0450 [a,b) >string ;
: russian-alphabet ( -- str ) 0x0451 6 russian-alphabet-without-io insert-nth ;
russian-alphabet print</
{{out}}
<pre>abcdefghijklmnopqrstuvwxyz
Line 1,222 ⟶ 1,381:
=={{header|FALSE}}==
<
{{Out}}
<pre>abcdefghijklmnopqrstuvwxyz</pre>
=={{header|Fermat}}==
<syntaxhighlight lang="fermat">Array locase[1,26];
[locase]:=[<i=1,26>'a'+i-1];
!([locase:char);</syntaxhighlight>
{{out}}<pre>abcdefghijklmnopqrstuvwxyz</pre>
=={{header|Forth}}==
Generate a string filled with the lowercase ASCII alphabet
<
Or coded another way
<
We could do something more complicated and allocate space for a string and fill it.
Two methods are demonstrated below
<syntaxhighlight lang="forth">create lalpha 27 chars allot \ create a string in memory for 26 letters and count byte
: ]lalpha ( index -- addr )
lalpha char+ + ;
Line 1,254 ⟶ 1,419:
: Loadit s" abcdefghijklmnopqrstuvwxyz" lalpha PLACE ;
</syntaxhighlight>
{{Output}}Test at the console
<syntaxhighlight lang="text">printit abcdefghijklmnopqrstuvwxyz ok
fillit ok
Line 1,265 ⟶ 1,430:
loadit ok
lalpha count type abcdefghijklmnopqrstuvwxyz ok
</syntaxhighlight>
=={{header|Fortran}}==
{{works with|Fortran|90 and later}}
<
integer :: i
do i = 1, 26
alpha(i:i) = achar(iachar('a') + i - 1)
end do</
=={{header|Free Pascal}}==
One can use ''set constructors'' like in [[#Delphi|Delphi]].
<tt>alphabet</tt>’s type will be <tt>set of char</tt>.
<
const
alphabet = ['a'..'z'];
begin
end.</
Note, Pascal does not define that the letters A through Z are contiguous, the set constructor above assumes that, though.
However, the FPC – the FreePascal compiler – virtually only works on systems, that use at least ASCII as common denominator.
Line 1,289 ⟶ 1,454:
=={{header|Frink}}==
The following produces a lazy enumerating sequence of the characters.
<
To produce a non-lazy array of the characters, you can wrap the above in a <CODE>toArray</CODE> call:
<
=={{header|Furor}}==
<syntaxhighlight lang="furor">
#k 'a 'z ++ {|| {} print SPACE |} NL end
</syntaxhighlight>
{{out}}
<pre>
a b c d e f g h i j k l m n o p q r s t u v w x y z
</pre>
=={{header|Peri}}==
<syntaxhighlight lang="peri">
###sysinclude standard.uh
#k 'a 'z ++ {{ , {{}} print SPACE }} NL end
</syntaxhighlight>
{{out}}
<pre>
a b c d e f g h i j k l m n o p q r s t u v w x y z
</pre>
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
long i
for i = asc("a") to asc("z")
print chr$(i);
next
HandleEvents
</syntaxhighlight>
{{output}}
<pre>
abcdefghijklmnopqrstuvwxyz
</pre>
=={{header|Gambas}}==
'''[https://gambas-playground.proko.eu/?gist=debd3987d4db75099032a86927978046 Click this link to run this code]'''
<
Dim siCount As Short
Line 1,311 ⟶ 1,500:
Next
End</
Output:
<pre>
Line 1,318 ⟶ 1,507:
=={{header|Go}}==
<
p := make([]byte, 26)
for i := range p {
Line 1,324 ⟶ 1,513:
}
return string(p)
}</
=={{header|Groovy}}==
<
Test
<
=={{header|Haskell}}==
<
main = print lower</
Or, equivalently:
<
alpha = enumFromTo 'a' 'z'
main :: IO ()
main = print alpha</
{{Out}}
<pre>"abcdefghijklmnopqrstuvwxyz"</pre>
=={{header|Hoon}}==
<syntaxhighlight lang="hoon">`(list cord)`(gulf 97 122)</syntaxhighlight>
{{Out}}
<pre>
> `(list cord)`(gulf 97 122)
<|a b c d e f g h i j k l m n o p q r s t u v w x y z|>
</pre>
=={{header|Huginn}}==
<
import Text as text;
Line 1,367 ⟶ 1,564:
)
);
}</
{{Out}}
<pre>abcdefghijklmnopqrstuvwxyz
Line 1,379 ⟶ 1,576:
E.g.
<
c := create !&lcase # lazy generation of letters in sequence</
<
procedure lower_case_letters() # entry point for function lower_case_letters
return &lcase # returning lower caser letters represented by the set &lcase
Line 1,390 ⟶ 1,587:
write(lower_case_letters()) # output of result of function lower_case_letters()
end
</syntaxhighlight>
=={{header|Insitux}}==
<syntaxhighlight lang="insitux>(-> (map char-code "az")
(adj _ inc)
(.. range)
(map char-code))</syntaxhighlight>
<pre>
["a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"]
</pre>
=={{header|J}}==
'''Solution''':<
thru&.(a.&i.)/'az'
abcdefghijklmnopqrstuvwxyz</
or<
abcdefghijklmnopqrstuvwxyz</
or<syntaxhighlight lang="j"> ([-.toupper)a.
abcdefghijklmnopqrstuvwxyz</syntaxhighlight>
and, obviously, other variations are possible.
=={{header|Java}}==
<syntaxhighlight lang="java">
char[] lowerAlphabet() {
char[] letters = new char[26];
for (int code = 97; code < 123; code++)
letters[code - 97] = (char) code;
return letters;
}
</syntaxhighlight>
<pre>
abcdefghijklmnopqrstuvwxyz
</pre>
An alternate implementation
<syntaxhighlight lang="java">public class LowerAscii {
public static void main(String[] args) {
Line 1,409 ⟶ 1,630:
System.out.printf("lower ascii: %s, length: %s", sb, sb.length());
}
}</
Output:
Line 1,423 ⟶ 1,644:
For Unicode characters beyond this range, in ES5 we have to enter a pair of Unicode number escapes.
<
function cRange(cFrom, cTo) {
Line 1,439 ⟶ 1,660:
return cRange(cFrom, cTo);
})('a', 'z');</
Returns:
<
===ES6===
Line 1,448 ⟶ 1,669:
In ES6, the new '''String.fromCodePoint()''' method can can return 4-byte characters (such as Emoji, for example) as well as the usual 2-byte characters.
<
function cRange(cFrom, cTo) {
Line 1,469 ⟶ 1,690:
['a', 'z'],
['🐐', '🐟']
]);</
Output:
<
["🐐", "🐑", "🐒", "🐓", "🐔", "🐕", "🐖", "🐗", "🐘", "🐙", "🐚", "🐛", "🐜", "🐝", "🐞", "🐟"]]</
{{works with|ECMAScript|6}}
<
for (var i = 97; i <= 122; i++) {
letters.push(String.fromCodePoint(i))
}</
Or, if we want to write a more general ES6 function:
<
// enumFromTo :: Enum a => a -> a -> [a]
const enumFromTo = (m, n) => {
Line 1,538 ⟶ 1,759:
['🐐', '🐟']
]));
})();</
{{Out}}
<pre>a b c d e f g h i j k l m n o p q r s t u v w x y z
Line 1,544 ⟶ 1,765:
א ב ג ד ה ו ז ח ט י ך כ ל ם מ ן נ ס ע ף פ ץ צ ק ר ש ת
🐐 🐑 🐒 🐓 🐔 🐕 🐖 🐗 🐘 🐙 🐚 🐛 🐜 🐝 🐞 🐟</pre>
=={{header|Joy}}==
<syntaxhighlight lang="joy">'a ['z =] ["" cons] [dup succ] [cons] linrec.</syntaxhighlight>
=={{header|jq}}==
<
produces:
Line 1,552 ⟶ 1,776:
=={{header|Jsish}}==
<
var letterA = "a".charCodeAt(0);
var lowers = Array(26);
Line 1,568 ⟶ 1,792:
26
=!EXPECTEND!=
*/</
{{out}}
Line 1,581 ⟶ 1,805:
{{works with|Julia|0.6}}
<
@show join('a':'z')</
{{out}}
Line 1,590 ⟶ 1,814:
=={{header|K}}==
<tt>`c$</tt> casts a list of integers to a string of characters; <tt>!26</tt> produces a list of the integers from 0 to 25. So the lower-case ASCII alphabet can be generated using:
<syntaxhighlight lang
{{out}}
<pre>"abcdefghijklmnopqrstuvwxyz"</pre>
=={{header|Keg}}==
<syntaxhighlight lang
=={{header|Kotlin}}==
<
fun main() {
Line 1,604 ⟶ 1,828:
println(alphabet)
}</
{{out}}
Line 1,612 ⟶ 1,836:
=={{header|Lambdatalk}}==
<
1) We define code2char & char2code as primitives:
Line 1,635 ⟶ 1,859:
{S.map code2char {S.serie {char2code 0} {char2code 9}}}
-> 0 1 2 3 4 5 6 7 8 9
</syntaxhighlight>
=={{header|Lang}}==
<syntaxhighlight lang="lang">
&alphabet = fn.arrayGenerateFrom(fn.combBX(fn.char, fn.add, a), 26)
fn.println(&alphabet)
# As string (Strings are called text in Lang)
$alphabetText = fn.join(\e, &alphabet)
fn.println($alphabetText)
</syntaxhighlight>
{{out}}
<pre>
[a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]
abcdefghijklmnopqrstuvwxyz
</pre>
=={{header|LC3 Assembly}}==
<
LD R0,ASCIIa
Line 1,652 ⟶ 1,892:
ASCIIa .FILL 0x61
ASCIIz .FILL 0x7A</
Output:
<pre>abcdefghijklmnopqrstuvwxyz</pre>
=={{header|Lingo}}==
<
repeat with i = 97 to 122
alphabet.add(numtochar(i))
end repeat
put alphabet
-- ["a", "b", "c", ... , "x", "y", "z"]</
=={{header|Logo}}==
Straightforward, assuming ASCII:
<
Slightly less straightforward, but without the magic numbers:
<
Same output either way:
{{Out}}
Line 1,675 ⟶ 1,915:
=={{header|Lua}}==
===to table===
<
local letters = {}
for ascii = 97, 122 do table.insert(letters, string.char(ascii)) end
Line 1,682 ⟶ 1,922:
local alpha = getAlphabet()
print(alpha[25] .. alpha[1] .. alpha[25]) </
{{Out}}
<pre>yay</pre>
===to string===
<
local function ascii(f,t) local tab={} for i=f,t do tab[#tab+1]=string.char(i) end
return table.concat(tab)
end
print(ascii(97,122))</
{{Out}}
<pre>> ./lowercaseascii.lua
Line 1,697 ⟶ 1,937:
=={{header|M2000 Interpreter}}==
<syntaxhighlight lang="m2000 interpreter">
\\ old style Basic, including a Binary.Or() function
Module OldStyle {
Line 1,707 ⟶ 1,947:
}
CALL OldStyle
</syntaxhighlight>
=={{header|Maple}}==
<
{{Out}}
<pre>"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"</pre>
Line 1,727 ⟶ 1,967:
'''Method 1''': Using a Range Variable.
<syntaxhighlight lang="mathcad">
-- user-defined function that returns the ASCII code for string character ch.
code(ch):=str2vec(ch)[0
Line 1,748 ⟶ 1,988:
-- Characters are indexable within the string; for example: substr(lcString,3,1)="d"
</
'''Method 2''': Using a Function.
<syntaxhighlight lang="mathcad">
-- Mathcad Express lacks the programming capability of Mathcad Prime, so uses the built-in if function to implement a recursive solution (if(predicate,true expr, false expr)).
Line 1,767 ⟶ 2,007:
charseq(code("α"),code("ω"))="αβγδεζηθικλμνξοπρςστυφχψω"
</syntaxhighlight>
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<
lowerCaseLetters = Table[FromCharacterCode[start + i], {i, 0, 25}]</
{{Out}}
<pre>{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}</pre>
=={{header|MATLAB}} / {{header|Octave}}==
<syntaxhighlight lang
or alternatively
<
{{Out}}<pre> abcdefghijklmnopqrstuvwxyz</pre>
=={{header|Maxima}}==
<syntaxhighlight lang="maxima">
delete([], makelist(if(alphacharp(ascii(i))) then parse_string(ascii(i)) else [], i, 96, 122));</
{{Out}}
<pre> [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z] </pre>
=={{header|Mercury}}==
<
:- interface.
Line 1,803 ⟶ 2,043:
io.print_line(Alphabet, !IO).
:- end_module gen_lowercase_ascii.</
{{out}}
<pre>
Line 1,810 ⟶ 2,050:
=={{header|MiniScript}}==
<
for i in range(code("a"), code("z"))
letters.push char(i)
end for
print letters</
{{out}}
<pre>["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]</pre>
=={{header|MIPS Assembly}}==
<syntaxhighlight lang="mips">main:
li $t0,'a'
li $t1,26
loop:
jal PrintChar ;prints the low 8 bits of $t0 as an ascii character (unimplemented routine)
nop ;branch delay slot
subiu $t1,1
bne $t1,loop
addiu $t0,1
end_program:
j end_program ;halt the cpu - we're done
nop</syntaxhighlight>
=={{header|MUMPS}}==
===Caché===
{{works with|Caché ObjectScript}}
<syntaxhighlight lang="mumps">
LOWASCMIN
set lowstr = ""
Line 1,828 ⟶ 2,084:
write lowstr
quit
</syntaxhighlight>
{{out}}<pre>
SAMPLES>DO ^LOWASCMIN
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
</pre>
===Standard MUMPS===
{{works with|DSM, MSM}}
<syntaxhighlight lang="mumps">
LONG SET D=""
FOR X=97:1:122 WRITE D,$C(X) SET D=","
WRITE !
QUIT
;
SHORT S D=""
F X=97:1:122 W D,$C(X) S D=","
W !
Q
</syntaxhighlight>
{{out}}<pre>
MGR>DO LONG
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
MGR>D SHORT
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
</pre>
=={{header|Nanoquery}}==
<
for i in range(ord("a"), ord("z"))
lowercase.append(chr(i))
end
println lowercase</
{{out}}
<pre>[a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]</pre>
=={{header|Neko}}==
<syntaxhighlight lang="actionscript">/**
<doc>Generate lower case ASCII, in Neko</doc>
**/
Line 1,859 ⟶ 2,136:
}
$print(generated, "\n")</
{{out}}
Line 1,867 ⟶ 2,144:
=={{header|NESL}}==
<
=={{header|NetLogo}}==
====Rationale====
Since NetLogo has no "ASC" type reporters, we will have to enumerate the characters.
To make an omission easier to detect, we use a phrase, instead of a list
Since the phrase has duplicates and spaces, we use other list tools to produce just the sorted alphabet
====Code====
<syntaxhighlight lang="netlogo">
to-report alphabet-lower
let sample "sphinx of black quartz judge my vow"
let alphabet sort remove-duplicates remove " " n-values length sample [ c -> item c sample ]
if length alphabet != 26 [ user-message "ERROR: invalid sample for alphabet function" ]
report alphabet
end
</syntaxhighlight>
====Output====
<pre>
observer> print alphabet-lower
[a b c d e f g h i j k l m n o p q r s t u v w x y z]
observer> write alphabet-lower
["a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"]
</pre>
=={{header|Nim}}==
<
let alpha: Slice[char] = 'a'..'z'
echo alpha # (a: a, b: z)
Line 1,889 ⟶ 2,187:
let alphaSeq = toSeq 'a'..'z'
echo alphaSeq # @[a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]
echo alphaSeq[10] # k</
=={{header|OCaml}}==
<
- : char array =
[|'a'; 'b'; 'c'; 'd'; 'e'; 'f'; 'g'; 'h'; 'i'; 'j'; 'k'; 'l'; 'm'; 'n'; 'o';
'p'; 'q'; 'r'; 's'; 't'; 'u'; 'v'; 'w'; 'x'; 'y'; 'z'|]</
Alternative version:
<syntaxhighlight lang="ocaml">Array.init 26 (fun x -> char_of_int (x + int_of_char 'a'))</syntaxhighlight>
=={{header|Oforth}}==
Oforth characters are integers. This list is a list of 26 integers
<syntaxhighlight lang
If necessary, these integers can be added to a string to have a indexed string of chars
<
=={{header|PARI/GP}}==
<
Output:<pre>"abcdefghijklmnopqrstuvwxyz"</pre>
=={{header|Pascal}}==
<
var
alphabet: set of char;
Line 1,920 ⟶ 2,221:
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
];
end.</
=={{header|Perl}}==
<syntaxhighlight lang
=={{header|Phix}}==
<!--<
<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: #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;">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>-->
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.
{{out}}
<pre>
"abcdefghijklmnopqrstuvwxyz"
"abcdefghijklmnopqrstuvwxyz"
"abcdefghijklmnopqrstuvwxyz"
Line 1,943 ⟶ 2,247:
=={{header|Phixmonti}}==
<
'a' 'z' 2 tolist
for
tochar 0 put
endfor
print</
Simplest
<
( 'a' 'z' ) for tochar print endfor</
=={{header|PHP}}==
<
$lower = range('a', 'z');
var_dump($lower);
?></
=={{header|Picat}}==
<syntaxhighlight lang="picat">main =>
Alpha1 = (0'a..0'z).map(chr),
println(Alpha1),
Alpha2 = [chr(I) : I in 97..122],
println(Alpha2).</syntaxhighlight>
{{out}}
<pre>abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz</pre>
=={{header|PicoLisp}}==
<syntaxhighlight lang="text">(mapcar char (range (char "a") (char "z")))</
=={{header|PL/I}}==
<
declare 1 ascii union,
2 letters (26) character (1),
Line 1,977 ⟶ 2,293:
put edit (letters) (a);
end gen;</
Output:
<pre>
Line 1,983 ⟶ 2,299:
</pre>
Alternative, using library:
<syntaxhighlight lang="text"> /* Accessing library lower-case ASCII (PC only). */
letter = lowercase('A');
i = index(collate(), letter);
put skip list (substr(collate, i, 26));</
Output:
<pre>
Line 1,993 ⟶ 2,309:
</pre>
=={{header|PL/M}}==
<syntaxhighlight lang="pli">100H: /* PRINT THE LOWERCASE LETTERS */
/* CP/M BDOS SYSTEM CALL */
BDOS: PROCEDURE( FN, ARG ); DECLARE FN BYTE, ARG ADDRESS; GOTO 5;END;
/* CONSOLE OUTPUT ROUTINES */
PR$STRING: PROCEDURE( S ); DECLARE S ADDRESS; CALL BDOS( 9, S ); END;
/* TASK */
DECLARE C BYTE, LC ( 27 )BYTE;
DO C = 0 TO 25;
LC( C ) = C + 32 + 'A';
END;
LC( LAST( LC ) ) = '$'; /* STRING TERMINATOR */
CALL PR$STRING( .LC );
EOF</syntaxhighlight>
{{out}}
<pre>
abcdefghijklmnopqrstuvwxyz
</pre>
=={{header|PL/SQL}}==
<
sbAlphabet varchar2(100);
Begin
Line 2,006 ⟶ 2,344:
End loop;
Dbms_Output.Put_Line(sbAlphabet);
End;</
Output:
<pre>
Line 2,015 ⟶ 2,353:
Total execution time 16 ms
</pre>
=={{header|Plain English}}==
<
Start up.
Generate the lowercase ASCII alphabet giving a string.
Line 2,032 ⟶ 2,368:
If the letter is the little-z byte, exit.
Add 1 to the letter.
Repeat.</
{{out}}
<pre>
Line 2,039 ⟶ 2,375:
=={{header|PowerShell}}==
<syntaxhighlight lang="powershell">
$asString = 97..122 | ForEach-Object -Begin {$asArray = @()} -Process {$asArray += [char]$_} -End {$asArray -join('')}
$asString
</syntaxhighlight>
{{Out}}
<pre>
abcdefghijklmnopqrstuvwxyz
</pre>
<syntaxhighlight lang="powershell">
$asArray
</syntaxhighlight>
{{Out}}
<pre>
Line 2,081 ⟶ 2,417:
'''Alternative:'''
<syntaxhighlight lang="powershell">
-join [Char[]] (97..122)
</syntaxhighlight>
{{Out}}
<pre>
Line 2,090 ⟶ 2,426:
'''Alternative as of PowerShell-v6.0.0rc:'''
<syntaxhighlight lang="powershell">
-join ('a'..'z')
</syntaxhighlight>
{{Out}}
<pre>
Line 2,100 ⟶ 2,436:
=={{header|Prolog}}==
Works with SWI-Prolog 6.5.3
<
maplist(atom_codes, [From, To], [[C_From], [C_To]]),
bagof([C], between(C_From, C_To, C), L1),
maplist(atom_codes,L, L1).
</syntaxhighlight>
Output :
<pre> ?- a_to_z(a, z, L).
Line 2,111 ⟶ 2,447:
=={{header|Python}}==
<
from string import ascii_lowercase
# Generation:
lower = [chr(i) for i in range(ord('a'), ord('z') + 1)]</
Or, as a particular instance of a more general enumeration pattern:
{{Works with|Python|3.7}}
<
from inspect import signature
Line 2,219 ⟶ 2,555:
# MAIN ---
if __name__ == '__main__':
main()</
{{Out}}
<pre>Enumeration a-z:
Line 2,234 ⟶ 2,570:
The word ''constant'' causes the preceding nest to be evaluated during compilation so ''alpha$'' is a literal, not an expression computed during program evaluation.
<
alpha$ echo$</
{{Out}}
Line 2,243 ⟶ 2,579:
=={{header|R}}==
<
letters
# Or generate the same with:
sapply(97:122, intToUtf8)</
=={{header|Racket}}==
<
=={{header|Raku}}==
Line 2,257 ⟶ 2,593:
{{works with|rakudo|2015-10-21}}
<syntaxhighlight lang="raku"
* <code>'a'..'z'</code> is a range literal, it constructs an immutable <code>Range</code> object.
Line 2,265 ⟶ 2,601:
===ASCII version===
This version only works under ASCII machines (where the values of the lowercase '''a''' through the lowercase '''z''' characters are contiguous (and consecutive).
<
* 08.02.2014 Walter Pachl
*--------------------------------------------------------------------*/
say xrange('a','z')</
'''Output:'''
<pre>abcdefghijklmnopqrstuvwxyz</pre>
Line 2,282 ⟶ 2,618:
Note that on an '''EBCDIC''' system, there are '''41''' characters between (lowercase) <big><big> a </big></big> ──► <big><big> z </big></big>
<br>(inclusive), some of which don't have viewable/displayable glyphs.
<
$= /*set lowercase letters list to null. */
do j=0 for 2**8; _=d2c(j) /*convert decimal J to a character. */
if datatype(_, 'L') then $=$ || _ /*Is lowercase? Then add it to $ list.*/
end /*j*/ /* [↑] add lowercase letters ──► $ */
say $ /*stick a fork in it, we're all done. */</
'''output'''
<pre>
Line 2,294 ⟶ 2,630:
=={{header|Ring}}==
<syntaxhighlight lang="ring">for i in 'a':'z'
put i
next</syntaxhighlight>
=={{header|RPL}}==
≪ ""
"a" NUM "z" NUM '''FOR''' ascii
ascii CHR + '''NEXT'''
≫ EVAL
{{out}}
<pre>
1: "abcdefghijklmnopqrstuvwxyz"
</pre>
=={{header|Ruby}}==
<
p [*'a' .. 'z']</
=={{header|Rust}}==
<
// An iterator over the lowercase alpha's
let ascii_iter = (0..26)
Line 2,311 ⟶ 2,655:
println!("{:?}", ascii_iter.collect::<Vec<char>>());
}</
{{out}}
<pre>
Line 2,319 ⟶ 2,663:
=={{header|S-lang}}==
Char_Type is just an integer-type so a "range array" can be easily created:
<
If you need single-char strings, convert thusly:
<
Let's take a peek:
<
foreach a (alpha_ch)
() = printf("%c ", a);
</syntaxhighlight>
{{out}}
<pre>"x"
Line 2,333 ⟶ 2,677:
=={{header|Scala}}==
{{libheader|Scala}}
<
val lowAlpha = 'a' to 'z' //That's all
// Now several tests
Line 2,350 ⟶ 2,694:
scala.compat.Platform.currentTime - executionStart
} ms]")
}</
Successfully completed without errors. [within 675 ms]
Line 2,357 ⟶ 2,701:
=={{header|Scheme}}==
{{works with|Gauche Scheme}}
<
{{output}}
<pre>
Line 2,365 ⟶ 2,709:
=={{header|Seed7}}==
<
const proc: main is func
Line 2,376 ⟶ 2,720:
end for;
writeln(lower);
end func;</
{{out}}
Line 2,384 ⟶ 2,728:
=={{header|Sidef}}==
<
say arr.join(' ');</
=={{header|Smalltalk}}==
<
asciiLower := String new.
97 to: 122 do: [:asciiCode |
asciiLower := asciiLower , asciiCode asCharacter
].
^asciiLower</
=={{header|Snobol}}==
<
=={{header|SPL}}==
<
d = [i+96,0]
a[i] = #.str(d)
Line 2,407 ⟶ 2,751:
> i, 1..#.size(a,1)
#.output(a[i],#.rs)
<</
{{out}}
<pre>
Line 2,414 ⟶ 2,758:
=={{header|Standard ML}}==
<
=={{header|Stata}}==
<
display c(alpha)
display c(ALPHA)
Line 2,429 ⟶ 2,773:
mata
char(97..122)
end</
=={{header|SuperCollider}}==
Previously, it was claimed that the method that maps ascii number to character is polymorphic on collections. However, that doesn't seem to be the case – at least not anymore in the newer version (3.10.2). A fix was added below the original code.
<syntaxhighlight lang="supercollider">
(97..122).asAscii; // This example unfortunately throws an error
// for me when running it on version 3.10.2
Line 2,453 ⟶ 2,797:
</syntaxhighlight>
Backwards:
<syntaxhighlight lang="supercollider">
"abcdefghijklmnopqrstuvwxyz".ascii
// answers [ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122 ]
</syntaxhighlight>
=={{header|Swift}}==
<
for i in 97...122 {
let char = Character(UnicodeScalar(i))
letters.append(char)
}</
=={{header|Tcl}}==
The most common way of doing this in Tcl would be to use a simple literal; it's only 51 characters after all:
<
Though it could be done like this as well:
<
scan "az" "%c%c" from to
for {set i $from} {$i <= $to} {incr i} {
Line 2,478 ⟶ 2,822:
}
return $l
}}]</
=={{header|UNIX Shell}}==
In bash or ksh93 with <tt>braceexpand</tt> set:
<
In zsh with <tt>braceccl</tt> set:
<
Either way, you can display the result like this:
<
{{Out}}<pre>a b c d e f g h i j k l m n o p q r s t u v w x y z</pre>
Line 2,495 ⟶ 2,839:
=={{header|Ursa}}==
Creates a string named low containing the lower case ASCII alphabet.
<
decl string low
for (set i (ord "a")) (< i (+ (ord "z") 1)) (inc i)
set low (+ low (chr i))
end for
out low endl console</
=={{header|VBA}}==
Line 2,507 ⟶ 2,851:
{{works with|Visual Basic|6}}
<syntaxhighlight lang="vb">
Option Explicit
Line 2,527 ⟶ 2,871:
Erase strarrTemp
End Function
</syntaxhighlight>
{{out}}
<pre>a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z</pre>
=={{header|VBScript}}==
<
arr = Split(range,"..")
For i = Asc(arr(0)) To Asc(arr(1))
Line 2,540 ⟶ 2,884:
WScript.StdOut.Write ASCII_Sequence(WScript.Arguments(0))
WScript.StdOut.WriteLine</
{{out}}
<pre>C:\>cscript /nologo ascii_sequence.vbs a..z
Line 2,547 ⟶ 2,891:
C:\>cscript /nologo ascii_sequence.vbs A..F
A B C D E F</pre>
=={{header|Verilog}}==
<syntaxhighlight lang="verilog">module main;
integer i;
initial begin
for(i = 97; i <= 122; i=i+1)
begin
$write("%c ",i);
end
$finish ;
end
endmodule
</syntaxhighlight>
{{out}}
<pre>a b c d e f g h i j k l m n o p q r s t u v w x y z </pre>
=={{header|Vim Script}}==
<
for c in range(0, 25)
let lower += [nr2char(c + char2nr("a"))]
endfor</
or:
<
=={{header|Visual Basic}}==
Line 2,567 ⟶ 2,928:
String.Join() is used to print the list, converted to array, without looping through it.
<
Sub Main()
Line 2,578 ⟶ 2,939:
End Module
</syntaxhighlight>
{{out}}
Line 2,584 ⟶ 2,945:
abcdefghijklmnopqrstuvwxyz
</pre>
=={{header|V (Vlang)}}==
<syntaxhighlight lang="v (vlang)">fn loweralpha() string {
mut p := []u8{len: 26}
for i in 97..123 {
p[i-97] = u8(i)
}
return p.bytestr()
}</syntaxhighlight>
=={{header|WebAssembly}}==
<syntaxhighlight lang="webassembly">(module $lowercase
(import "wasi_unstable" "fd_write"
(func $fd_write (param i32 i32 i32 i32) (result i32))
)
(memory 1)
(export "memory" (memory 0))
(func $main (export "_start")
(local $i i32)
(i32.store (i32.const 0) (i32.const 8)) ;; offset to start of string
(i32.store (i32.const 4) (i32.const 27)) ;; string length
(set_local $i (i32.const 0))
(loop
;; mem[i+8] = i+97
(i32.store (i32.add (get_local $i) (i32.const 8)) (i32.add (get_local $i) (i32.const 97)))
;; i = i+1
(set_local $i (i32.add (get_local $i) (i32.const 1)))
;; if i < 26 then loop
(br_if 0 (i32.lt_s (get_local $i) (i32.const 26)))
)
;; append a newline
(i32.store (i32.add (get_local $i) (i32.const 8)) (i32.const 10))
;; write to stdout
(call $fd_write
(i32.const 1) ;; output stream to write to (1 == stdout)
(i32.const 0) ;; memory location containing string offset and length
(i32.const 1) ;; number of strings to write
(i32.const 40) ;; location in memory to write number of bytes written
)
drop
)
)</syntaxhighlight>
{{out}}
<pre>
abcdefghijklmnopqrstuvwxyz
</pre>
=={{header|Wren}}==
<
for (c in 97..122) alpha.add(String.fromByte(c))
System.print(alpha.join())</
{{out}}
Line 2,596 ⟶ 3,011:
=={{header|xEec}}==
<
=={{header|XLISP}}==
<
(defun add-chars (x y s)
(if (<= x y)
(add-chars (+ x 1) y (string-append s (string (integer->char x))))
s))
(add-chars 97 122 ""))</
=={{header|XPL0}}==
<
for I:= 0 to 26-1 do A(I):= I+^a</
=={{header|Z80 Assembly}}==
<syntaxhighlight lang="z80"> org &8000
ld a,'a' ;data
ld b,26 ;loop counter
ld hl,Alphabet ;destination
loop:
ld (hl),a ;store "a" into ram
inc a ;next letter
inc hl ;next storage byte
djnz loop ;repeat until 26 letters were stored.
call Monitor_MemDump ;hexdumps the specified address and bytecount to screen - created by Keith S. of Chibiakumas
byte 32 ;number of bytes to display
word Alphabet ;address to dump from
ret ;return to basic
Alphabet:
ds 26,0 ;reserve 26 bytes of ram, init all to zero.</syntaxhighlight>
{{out}}
<pre>
8013:
61 62 63 64 65 66 67 68 abcdefgh
69 6A 6B 6C 6D 6E 6F 70 ijklmnop
71 72 73 74 75 76 77 78 qrstuvwx
79 7A 00 00 00 00 00 00 yz
</pre>
=={{header|zkl}}==
<
["a".."z"].walk() //-->L("a","b","c","d","e",...
"a".toAsc().pump(26,List,"toChar") // another way to create the list
"a".toAsc().pump(26,String,"toChar") // create a string
//-->"abcdefghijklmnopqrstuvwxyz"
Utils.Helpers.lowerLetters // string const</
=={{header|Zig}}==
<syntaxhighlight lang="zig">const std = @import("std");
pub fn main() !void {
const cnt_lower = 26;
var lower: [cnt_lower]u8 = undefined;
comptime var i = 0;
inline while (i < cnt_lower) : (i += 1)
lower[i] = i + 'a';
const stdout_wr = std.io.getStdOut().writer();
for (lower) |l|
try stdout_wr.print("{c} ", .{l});
try stdout_wr.writeByte('\n');
}</syntaxhighlight>
|