; Asc Example ; ----------- ; Asc returns the ASCII code of the first character of a string. ; Character codes are handy for checksums, sorting and name entry. initials$="ACE" Print "High-score initials: "+initials$ Print "" ; Show the code of each letter For i=1 To Len(initials$) letter$=Mid$(initials$,i,1) Print "Asc('"+letter$+"') = "+Asc(letter$) Next ; Letters can be compared as numbers - that is how names get sorted Print "" Print "'A' sorts before 'B' because "+Asc("A")+" < "+Asc("B") ; A simple save-file checksum built from the character codes checksum=0 For i=1 To Len(initials$) checksum=checksum+Asc(Mid$(initials$,i,1)) Next Print "Checksum of "+initials$+" = "+checksum Print "" Print "Press any key to close the example" WaitKey End