rcRead (“reverse cRead”) returns the character code of the last character of the STRING s, and then removes that character from the STRING.
If s is the empty STRING, -1 is returned. -1 is not a valid character code.
Example 46–6. Use of rcRead
|INTEGER t; STRING s;|
s := "abc";
t := rcRead(s);
# Now t = 'c', s = "ab"
STRING PROCEDURE reverse (STRING s);
BEGIN # reverse characters of s
r := "";
WHILE s DO cWrite(r,rcRead(s));