Table of Contents

ASC

Returns the ASCII code for a single or the first character of a longer string

Implemented by: dartmouth5, altair8K, a2int, TI994, CBM, Atari, msatari, level2, trscolor, colormc, BBC, GWBASIC, MSX, bwbasic, bw32, ABasiC, QBasic, VBDOS, FreeBASIC, Gambas, ugBASIC, minibasicjs, EndBASIC

With variations:

Also written as: ASCII

Usage

C = ASC("h")
C = ASC(A$)

The ASC function is

Variations

On some BASICs, like #zx81, only a single character is allowed as argument.

The function is called ASCII in #dec10 BASIC.

Examples

A very BASIC one to start with.

10 INPUT "DROP ME A WORD"; A$
20 PRINT "HMM, IT STARTS WITH ASCII CHARACTER"; ASC(A$)
30 END

Comments

Similar keywords

In other languages...

Other tags

#Functions

References

David A. Lien, The BASIC Handbook, 2nd edition.