| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== VAL (return character code value) ====== | [[upper return upper case .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[watch automatic concurrency check .htm|{{btn_next_n.gif|Next page}}]] | | || **VAL(**//character//**)** {{blk2blue.jpg|blk2blue.jpg}} | **VAL** | Returns a character code value. | | //character// | A one character string containing an ANSI or Unicode character. | The **VAL** procedure returns the numeric code of a //character//. If the compiler can determine type of parameter (literal string or variable), it returns a result of BYTE (for ANSI strings) or a USHORT (for Unicode strings). If the type of parameter can't be determined the compiler generates code to push its value to the string stack and returns a result of SIGNED type. To force a specific encoding of the character parameter you can use the **TOANSI **or **TOUNICODE** functions . **Return Data Type:     **BYTE, USHORT or SIGNED (See above) **Example:** VAL('A')          !RETURNS 65 VAL('z')          !RETURNS 122 VAL('Ж')          !RETURNS 1046 VAL('Σ')          !RETURNS 933 CharCode = VAL(StrChar)      !Get the character code value of the character **See Also:** [[chr return character from ascii .htm|CHR]] [[tounicode.htm|TOUNICODE]] [[toansi.htm|TOANSI]]