Character codes: Difference between revisions

(added Fortran)
Line 145:
In Ruby currently characters are usually represented directly as their integer character code. Ruby has a syntax for "character literal" which evaluates directly to the integer code: <code>?a</code> evaluates to the integer 97. Subscripting a string also gives just the integer code for the character.
 
<ruby>print ?a, "\n" # prints "97"
print 'a'[0], "\n" # prints "97"
print 97.chr, "\n" # prints "a"; "91.chr" returns a string of length 1</ruby>
 
=={{header|Scheme}}==
Anonymous user