

Task

Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses).



Example

The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode).

Conversely, given a code, print out the corresponding character.




Prgm
  Local k, s
  ClrIO
  Loop
    Disp "Press a key, or ON to exit."
    getKey() © clear buffer
    0 → k : While k = 0 : getKey() → k : EndWhile
    ClrIO
    If k ≥ 256 Then
      Disp "Not a character."
      Disp "Code: " & string(k)
    Else
 
      char(k) → s                           ©
      © char() and ord() are inverses.      ©
      Disp "Character: " & s                ©
      Disp "Code: " & string(ord(s))        ©
 
    EndIf
  EndLoop
EndPrgm